Open
Description
The utility will currently generate the same input types for queries as mutations.
Example of generated input type and its usage in queries and mutations:
input AirportInput {
_id: ID
type: String
city: String
icao: String
code: String
country: String
lat: Float
longest: Float
runways: Float
desc: String
lon: Float
region: String
elev: Float
}
type Query {
getNodeAirport(filter: AirportInput): Airport
}
type Mutation {
createNodeAirport(input: AirportInput!): Airport
updateNodeAirport(input: AirportInput!): Airport
deleteNodeAirport(_id: ID!): Boolean
}
This is not ideal as it would be expected that the required fields will differ for queries vs mutations. For example, id should not be mandatory when creating a node as it should be auto generated by the server. However id should be required when updating a node.
Generating distinct input types for queries vs create/update/delete mutations will provide better flexibility to the user to modify the generated schema accordingly.
Example of distinct input types for which id is required for update but not create:
input AirportCreateInput {
_id: ID
city: String
code: String
country: String
}
input AirportUpdateInput {
_id: ID!
city: String
code: String
country: String
}
type Mutation {
createNodeAirport(input: AirportCreateInput!): Airport
updateNodeAirport(input: AirportUpdateInput!): Airport
}
Metadata
Metadata
Assignees
Labels
No labels