Skip to content

Add descriptions to executable definitions #892

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

IvanGoncharov
Copy link
Member

@IvanGoncharov IvanGoncharov commented Oct 7, 2021

Was already discussed during WG: https://github.com/graphql/graphql-wg/blob/main/notes/2021-04-01.md#adding-descriptions-to-queries-and-fragments-ivan

I prepare a format proposal, here is a couple of key points:

  1. You can add descriptions on operations, fragments, and query variables
  2. You can't add description on the short form of operation only full form.

Example:

"Some description"
query SomeOperation(
  "ID you should provide"
  $id: String
  
  "Switch for experiment ...."
  $enableBaz: Boolean = false,
) {
  foo(id: $id) {
    bar
    baz @include(if: $enableBaz) {
      ...BazInfo
    }
  }
}

"Some description here"
fragment BazInfo on Baz {
  # ...
}

@netlify
Copy link

netlify bot commented Oct 7, 2021

✔️ Deploy Preview for graphql-spec-draft ready!

🔨 Explore the source changes: 14cce61

🔍 Inspect the deploy log: https://app.netlify.com/sites/graphql-spec-draft/deploys/615f262e5946770008f041ee

😎 Browse the preview: https://deploy-preview-892--graphql-spec-draft.netlify.app/draft

@IvanGoncharov
Copy link
Member Author

It's an incomplete PR at the moment:

  • Need to expand "Descriptions" in Section 2
  • Need to figure out what to do with duplicating "Descriptions" in Section 3

@leebyron leebyron added the 💡 Proposal (RFC 1) RFC Stage 1 (See CONTRIBUTING.md) label Oct 7, 2021
@IvanGoncharov
Copy link
Member Author

Capturing feedback from WG (suggested by @fotoetienne):
Add a note that descriptions on executable definitions or comments (retroactive change) must not change execution, validation, or response of graphql document. And it is safe to remove comments and descriptions from executable documents.

@IvanGoncharov
Copy link
Member Author

Implemented in graphql/graphql-js#3402

@leebyron
Copy link
Collaborator

@fotoetienne is volunteering to champion this RFC, and we agreed to move this to Draft RFC 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📄 Draft (RFC 2) RFC Stage 2 (See CONTRIBUTING.md)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants