Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure interface nullable types can be implemented by non-nullable types #1009

Merged
merged 1 commit into from
Dec 25, 2020

Conversation

maartenvanvliet
Copy link
Contributor

Fixes #987

Two cases are added to the schema:

  • a simple nullable interface -> non-nullable implementor.
  • a nullable list -> with implementors list_of(non_null(type)) and
    non_null(list_of(non_null(type))).

From my reading of the spec these should all validate.

https://spec.graphql.org/draft/#IsValidImplementationFieldType()

I did find that it is not validated whether the object implements
the field's arguments as specified by the interface. Also that the object
does not implement extra non-nullable arguments that are not specified in the interface.

From the spec

field must include an argument of the same name for every argument defined in implementedField.

    That named argument on field must accept the same type (invariant) as that named argument on implementedField.

field may include additional arguments not defined in implementedField, but any additional argument must not be required, e.g. must not be of a non‐nullable type.

I'll create an issue for this.

Fixes absinthe-graphql#987

Two cases are added to the schema:
 * a simple nullable interface -> non-nullable implementor.
 * a nullable list -> with implementors `list_of(non_null(type))` and
   `non_null(list_of(non_null(type)))`.

From my reading of the spec these should all validate.

https://spec.graphql.org/draft/#IsValidImplementationFieldType()

I did find that it is not validated whether the object implements
the field's arguments. Also that the object does not implement
extra non-nullable arguments that are not specified in the interface,
this is not allowed. I'll create an issue for this.
Copy link
Contributor

@benwilson512 benwilson512 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks! Good point about arguments, definitely an area we should improve.

@benwilson512 benwilson512 merged commit eaedd98 into absinthe-graphql:master Dec 25, 2020
@maartenvanvliet maartenvanvliet deleted the issues/987 branch December 25, 2020 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nullable interface fields cannot have their implementing sub-type be non-nullable.
2 participants