Complete the code to define a GraphQL input type with a required string field.
input UserInput {
name: [1]!
}Int or Boolean for a text field.The name field should be of type String and required, so we use String!.
Complete the code to add an optional integer field for age in the input type.
input UserInput {
age: [1]
}String instead of Int for numbers.The age field should be an optional integer, so use Int without an exclamation mark.
Fix the error in the input type by choosing the correct scalar type for a boolean field.
input UserInput {
isActive: [1]!
}String or Int for boolean fields.The isActive field is a boolean, so it must use the Boolean scalar type with an exclamation mark to be required.
Fill both blanks to create an input type with a required email string and an optional age integer.
input UserInput {
email: [1]!
age: [2]
}!.Boolean for email or age fields.The email field is a required string, so use String!. The age field is an optional integer, so use Int without !.
Fill all three blanks to define an input type with a required username string, an optional age integer, and a required active boolean.
input UserInput {
username: [1]!
age: [2]
active: [3]!
}! for required fields.The username is a required string (String!), age is an optional integer (Int), and active is a required boolean (Boolean!).