Closed jcward closed 6 years ago
It would appear that arguments have no bearing on the basic schema. They only have bearing on queries. Because no matter what you pass for arguments, the output type is still the given type.
e.g. Given these definitions...
height(unit: LengthUnit = METER): Float!
hero(episode: Episode = NEWHOPE): Character
droid(id: ID!): Droid
... No matter what [unit, episode, id] you pass you, you're still going to get a [Float, Character, Droid] out.
To support the generation of strongly-typed queries, we'll want to create a type that describes the arguments. e.g.
interface Character {
id: ID!
name: String!
friends: [Character]
friendsConnection(first: Int, after: ID): FriendsConnection!
}
The gql2ts generator spits this out:
interface ICharacter {
__typename: 'Character';
id: string;
name: string;
friends: Array<Character> | null;
friendsConnection: IFriendsConnection;
}
interface IFriendsConnectionOnCharacterArguments {
first?: number | null;
after?: string | null;
}
Support for arguments and default values via:
4f39c6c 3e9e37e 8e1e931
Think about support for arguments in the schema: