-
Notifications
You must be signed in to change notification settings - Fork 45
feat(compiler, parser): support executable document descriptions #974
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
base: main
Are you sure you want to change the base?
Conversation
Support for parsing and serializing descriptions on: - (longhand) operation definitions - fragment definitions - variable definitions As described by the latest GraphQL spec draft: graphql/graphql-spec#1170 Adding a description on a query shorthand (bare braced selection set) raises a parse error. This is a breaking change for apollo-compiler due to the addition of new fields: - `apollo_compiler::ast::OperationDefinition::description` - `apollo_compiler::ast::FragmentDefinition::description` - `apollo_compiler::ast::VariableDefinition::description` - `apollo_compiler::executable::Operation::description` - `apollo_compiler::executable::Fragment::description` For most users, adding `description: None` anywhere they create one of these structures is good enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good!
The only thing that needs to change is that the new file in apollo-compiler/test_data/diagnostics
is missing it's matching .txt
pair. Other comments are clarification questions.
Since this is a breaking change for the compiler, do we need to have a conversation about what should go into the next major version of the compiler (if there is anything)?
...es/apollo-compiler/test_data/serializer/diagnostics/0125_query_shorthand_description.graphql
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this missing a matching .txt file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, should we have this test case in the parser's test_data directory for posterity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also have this test case in the parser's test_data directory for posterity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
I reviewed the PR before seeing your message in slack asking the exact same thing. Carry on! |
@@ -33,6 +41,11 @@ pub(crate) fn variable_definitions(p: &mut Parser) { | |||
/// Variable **:** Type DefaultValue? Directives[Const]? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@goto-bus-stop Update these comments
@@ -25,6 +25,7 @@ pub struct FragmentDef { | |||
impl From<FragmentDef> for ast::Definition { | |||
fn from(x: FragmentDef) -> Self { | |||
ast::FragmentDefinition { | |||
description: None, // TODO(@goto-bus-stop): represent description |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@goto-bus-stop fix these things
Support for parsing and serializing descriptions on:
As described by the latest GraphQL spec draft: graphql/graphql-spec#1170
Adding a description on a query shorthand (bare braced selection set) raises a parse error.
This is a breaking change for apollo-compiler due to the addition of new fields:
apollo_compiler::ast::OperationDefinition::description
apollo_compiler::ast::FragmentDefinition::description
apollo_compiler::ast::VariableDefinition::description
apollo_compiler::executable::Operation::description
apollo_compiler::executable::Fragment::description
For most users, adding
description: None
anywhere they create one of these structures is good enough.Todos