graphql-spec icon indicating copy to clipboard operation
graphql-spec copied to clipboard

3.13 Directive validation edits

Open jbellenger opened this issue 1 year ago • 7 comments

The Validation section for Directive types is a little out of step with the validation sections for the other types. In particular, while the grammar definition of Directive requires one or more directive locations, this requirement isn't mentioned in the validation section.

Compare this to the validation sections for other types with "one or more" requirements:

  • 1. An Object type must define one or more fields.
  • 1. A Union type must include one or more member types.
  • 1. An Enum type must define one or more unique enum values.
  • 1. An Input Object type must define one or more input fields.
  • 1. An Interface type must define one or more fields.

This PR updates Directive validation to be more consistent with the validation sections of other types:

  1. Add a "one or more" requirement as the first validation rule
  2. Use "Directive" instead of "directive"
  3. Rename the section from "Validation" to "Type Validation"

While this PR just clarifies the existing spec, I suspect it might be common for implementations to not check for non-empty directive locations. I've updated graphql-java and can do the same for graphql-js if I get a tentative OK on this PR.

jbellenger avatar Apr 02 '24 13:04 jbellenger

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: benjie / name: Benjie (c8ca2c124de7d9d772be7a30de658d130cb99643)
  • :white_check_mark: login: jbellenger / name: James Bellenger (71a76edd98f7bad13e88371c10bc7805779d850a, cb28e5edc2c919fca97d539d77adda89d6b87d20)

Deploy Preview for graphql-spec-draft ready!

Name Link
Latest commit c8ca2c124de7d9d772be7a30de658d130cb99643
Latest deploy log https://app.netlify.com/sites/graphql-spec-draft/deploys/6643359ba7e18800088d3a03
Deploy Preview https://deploy-preview-1089--graphql-spec-draft.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Apr 02 '24 13:04 netlify[bot]

I've https://github.com/graphql-java/graphql-java/pull/3552 and can do the same for graphql-js if I get a tentative OK on this PR.

@jbellenger Please go ahead and make the changes to GraphQL.js :raised_hands:

benjie avatar May 14 '24 09:05 benjie

Nice! Great to see the spec clarified

dondonz avatar May 14 '24 22:05 dondonz

GraphQL.js backport into v16 open here: https://github.com/graphql/graphql-js/pull/4137

benjie avatar Jul 01 '24 13:07 benjie

Scheduled for discussion in Thursday's WG: https://github.com/graphql/graphql-wg/blob/main/agendas/2024/07-Jul/18-wg-primary.md

benjie avatar Jul 15 '24 07:07 benjie

cc @graphql/tsc: TL;DR: merging this in one week unless anyone raises concerns.

This was discussed at last nights WG (replay; agenda; notes) and it was agreed this is an editorial fix and good to merge. It already has two TSC approvals but I'll leave it open another week or so and then go ahead and merge it. Essentially, we see this as a bugfix.

benjie avatar Jul 19 '24 10:07 benjie