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
actor
takesint
input argument fieldavatarurl
? - can subtype of
actor
declare more input arguments onavatarurl
field?
this transpiler schema language (client implementation), don't want make assumptions can fail @ runtime.
as far graphql.js concerned:
yes, type implements
actor
interface need includesize
argument onavatarurl
field 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
actor
declare 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