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! } 
  1. is safe assume each type implements actor takes int input argument field avatarurl?
  2. can subtype of actor declare more input arguments on avatarurl field?

this transpiler schema language (client implementation), don't want make assumptions can fail @ runtime.

as far graphql.js concerned:

  1. yes, type implements actor interface need include size argument on avatarurl 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.

  2. 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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -