//
// Copyright (c) 2019 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
[[at_input_field]]
=== @InputField

Controls the mapping of the property to an input object field. These are distinct from fields on an output object.

.Parameters
[cols="1,1"]
|===
|*value*|The name of the corresponding input object field should have in the GraphQL schema
|*description*|The description of the corresponding input object field
|===

.Example
[source,java,numbered]
----
@Type(value = "Starship", description = "A starship from Starwars")
@InputType(value = "StarshipInput", description = "Input object for a starship")
public class Starship {
   @InputField(value = "uuid", description = "uuid of a new Starship")
   private String id;
   private String name;
   private float length;

   //  Getters, setters...
}
----

Resulting schema SDL:

[source,json,numbered]
----
# Input object for a starship
input Starship {
   # uuid of a new starship
   uuid: String
   name: String
   length: Float
}

# A starship from Starwars
type Starship {
   id: String
   name: String
   length: Float
}
----