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

Add support for repeatable directives #999

Merged

Conversation

maartenvanvliet
Copy link
Contributor

Adds support for repeatable directives as defined by the spec (https://spec.graphql.org/draft/#sec-Type-System.Directives). See graphql/graphql-spec#472 where the RFC was merged for more information.

This PR does several things:

  • adds support for the repeatable keyword for directives in the parser
  • directives by default have repeatable set to false
  • renders directives with repeatable in SDL
  • adds isRepeatable to the directive type available for introspection
  • adds repeatable(true|false) to the schema definition macro's placed under directive
  • adds validation phase in the document pipeline to check whether a non-repeatable phase is applied multiple times
  • changes the directive type to match the spec (other built-in types could also be tightened with non_null declarations to closer match the spec, but can be done in a separate PR)

In theory this could be a breaking change, i.e. if the built-in directives were applied multiple times to the same field in a document this will now trigger an error.

@benwilson512
Copy link
Contributor

@maartenvanvliet this is fantastic, thank you! We will probably target this for the 1.6 release which we hope to go ahead with by the end of the year due to the potential for breakage you note. Will review implementation here shortly.

Copy link
Contributor

@binaryseed binaryseed left a comment

Choose a reason for hiding this comment

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

This looks awesome! From my read, it looks like everything is in place & tested.. Nice work!

@benwilson512 benwilson512 merged commit 9cb0900 into absinthe-graphql:master Dec 22, 2020
@maartenvanvliet maartenvanvliet deleted the add-repeatable-directives branch December 22, 2020 07:49
@binaryseed
Copy link
Contributor

Followup that adds this to the IntrospectionQuery provided by Absinthe: #1008

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.

None yet

3 participants