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 test case for failing parsing #1166

Merged
merged 2 commits into from
Dec 20, 2017

Conversation

freiksenet
Copy link
Contributor

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).

@leebyron
Copy link
Contributor

Great catch! Thanks for reporting this.

We may need to rethink field-less type extensions to solve for this ambiguity :/

@freiksenet
Copy link
Contributor Author

I think allowing empty fields' blocks at parse time could work.

@leebyron
Copy link
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})`
@leebyron leebyron changed the base branch from master to sdl-implements-multiple-interfaces December 20, 2017 01:32
@leebyron
Copy link
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

@leebyron leebyron force-pushed the sdl-implements-multiple-interfaces branch from 4041853 to a930eec Compare December 20, 2017 01:44
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})`
@leebyron leebyron force-pushed the sdl-implements-multiple-interfaces branch from a930eec to c772768 Compare December 20, 2017 20:01
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 leebyron force-pushed the sdl-implements-multiple-interfaces branch from c772768 to f317a65 Compare December 20, 2017 20:05
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})`
@leebyron leebyron changed the base branch from sdl-implements-multiple-interfaces to master December 20, 2017 20:42
@leebyron leebyron merged commit 674e3c7 into graphql:master Dec 20, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants