Add test case for failing parsing#1166
Merged
leebyron merged 2 commits intographql:masterfrom Dec 20, 2017
Merged
Conversation
Contributor
|
Great catch! Thanks for reporting this. We may need to rethink field-less type extensions to solve for this ambiguity :/ |
10 tasks
Contributor
Author
|
I think allowing empty fields' blocks at parse time could work. |
Contributor
|
Yeah, I think you're right. Requiring a fields block, but allowing the fields block to be empty might have to be the answer here, even though it's a bit inconsistent with other grammar rules in GraphQL :/ I'll do a bit of brainstorming with a few other folks and we'll resolve this quickly |
leebyron
added a commit
that referenced
this pull request
Dec 20, 2017
This replaces:
```graphql
type Foo implements Bar, Baz { field: Type }
```
With:
```graphql
type Foo implements Bar & Baz { field: Type }
```
With no changes to the common case of implementing a single interface.
This is more consistent with other trailing lists of values which either have an explicit separator (union members) or are prefixed with a sigil (directives). This avoids parse ambiguity in the case of an omitted field set, illustrated by #1166
This is a breaking change for existing uses of multiple inheritence. To allow for an adaptive migration, this adds a parse option to continue to support the existing experimental SDL: `parse(source, {legacySDL: true})`
Contributor
|
After brainstorming came up with what I think is a more consistent solution, though it does constitute more of a breaking change from existing usage. See #1169 for a path forward along with suggested migration tools |
4041853 to
a930eec
Compare
leebyron
added a commit
that referenced
this pull request
Dec 20, 2017
This replaces:
```graphql
type Foo implements Bar, Baz { field: Type }
```
With:
```graphql
type Foo implements Bar & Baz { field: Type }
```
With no changes to the common case of implementing a single interface.
This is more consistent with other trailing lists of values which either have an explicit separator (union members) or are prefixed with a sigil (directives). This avoids parse ambiguity in the case of an omitted field set, illustrated by #1166
This is a breaking change for existing uses of multiple inheritence. To allow for an adaptive migration, this adds a parse option to continue to support the existing experimental SDL: `parse(source, {legacySDL: true})`
a930eec to
c772768
Compare
leebyron
added a commit
that referenced
this pull request
Dec 20, 2017
This replaces:
```graphql
type Foo implements Bar, Baz { field: Type }
```
With:
```graphql
type Foo implements Bar & Baz { field: Type }
```
With no changes to the common case of implementing a single interface.
This is more consistent with other trailing lists of values which either have an explicit separator (union members) or are prefixed with a sigil (directives). This avoids parse ambiguity in the case of an omitted field set, illustrated by #1166
This is a breaking change for existing uses of multiple inheritence. To allow for an adaptive migration, this adds a parse option to continue to support the existing experimental SDL: `parse(source, {allowLegacySDLImplementsInterfaces: true})`
c772768 to
f317a65
Compare
leebyron
added a commit
that referenced
this pull request
Dec 20, 2017
This replaces:
```graphql
type Foo implements Bar, Baz { field: Type }
```
With:
```graphql
type Foo implements Bar & Baz { field: Type }
```
With no changes to the common case of implementing a single interface.
This is more consistent with other trailing lists of values which either have an explicit separator (union members) or are prefixed with a sigil (directives). This avoids parse ambiguity in the case of an omitted field set, illustrated by #1166
This is a breaking change for existing uses of multiple inheritence. To allow for an adaptive migration, this adds a parse option to continue to support the existing experimental SDL: `parse(source, {allowLegacySDLImplementsInterfaces: true})`
leebyron
added a commit
that referenced
this pull request
Dec 20, 2017
This replaces:
```graphql
type Foo implements Bar, Baz { field: Type }
```
With:
```graphql
type Foo implements Bar & Baz { field: Type }
```
With no changes to the common case of implementing a single interface.
This is more consistent with other trailing lists of values which either have an explicit separator (union members) or are prefixed with a sigil (directives). This avoids parse ambiguity in the case of an omitted field set, illustrated by #1166
This is a breaking change for existing uses of multiple inheritence. To allow for an adaptive migration, this adds a parse option to continue to support the existing experimental SDL: `parse(source, {allowLegacySDLImplementsInterfaces: true})`
tonyghita
added a commit
to graph-gophers/graphql-go
that referenced
this pull request
Mar 7, 2018
This replaces:
```graphql
type Foo implements Bar, Baz { field: Type }
```
With:
```graphql
type Foo implements Bar & Baz { field: Type }
```
This is more consistent with other trailing lists of values which
either have an explicit separator (union members) or are prefixed
with a sigil (directives). This avoids parse ambiguity in the
case of an omitted field set, illustrated by
[github.com/graphql/graphql-js#1166](graphql/graphql-js#1166).
For now, the old method of declaration remains valid.
References:
- graphql/graphql-js#1169
- graphql/graphql-spec#90
- graphql/graphql-spec@32b55ed
tinnywang
pushed a commit
to tinnywang/graphql-go
that referenced
this pull request
Dec 13, 2018
This replaces:
```graphql
type Foo implements Bar, Baz { field: Type }
```
With:
```graphql
type Foo implements Bar & Baz { field: Type }
```
This is more consistent with other trailing lists of values which
either have an explicit separator (union members) or are prefixed
with a sigil (directives). This avoids parse ambiguity in the
case of an omitted field set, illustrated by
[github.com/graphql/graphql-js#1166](graphql/graphql-js#1166).
For now, the old method of declaration remains valid.
References:
- graphql/graphql-js#1169
- graphql/graphql-spec#90
- graphql/graphql-spec@32b55ed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extend without fields followed by extend makes second extend to be parsed as types to implement. Note that locations are faulty in test (cause it's hard to deduce them).