Reputation: 1225
For example, the GitHub API declares a type called Actor
:
interface Actor {
avatarUrl(size: Int): URI!
login: String!
resourcePath: URI!
url: URI!
}
Actor
takes an Int
input argument for the field avatarUrl
?Actor
declare more input arguments on the avatarUrl
field?This is for a transpiler for the schema language (client implementation), so I don't want to make any assumptions which can fail at runtime.
Upvotes: 2
Views: 94
Reputation: 84877
As far as GraphQL.js is concerned:
Yes, any type that implements the Actor
interface will need to include the size
argument on its avatarUrl
field in the type definition.
To be clear, if the argument is not-NonNull, a client could still leave it off inside a query. However, it will always need to be included in the type definition or GraphQL will complain.
Yes, the type implementing Actor
could declare additional arguments on the field beyond what the Interface mandates. I imagine this would be something of an edge case, as these arguments would not be usable on any queries returning the interface. But a query returning the specific type, not the interface, could technically utilize the additional arguments.
Upvotes: 1