javascript - Does a GraphQL Interface definition bind its implementing types to using the same input argument "signature"? -
for example, github api declares type called actor:
interface actor { avatarurl(size: int): uri! login: string! resourcepath: uri! url: uri! } - is safe assume each type implements
actortakesintinput argument fieldavatarurl? - can subtype of
actordeclare more input arguments onavatarurlfield?
this transpiler schema language (client implementation), don't want make assumptions can fail @ runtime.
as far graphql.js concerned:
yes, type implements
actorinterface need includesizeargument onavatarurlfield in type definition.to clear, if argument not-nonnull, client still leave off inside query. however, need included in type definition or graphql complain.
yes, type implementing
actordeclare additional arguments on field beyond interface mandates. imagine of edge case, these arguments not usable on queries returning interface. query returning specific type, not interface, technically utilize additional arguments.
wiki
Comments
Post a Comment