-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Issue 3332 - overlapping aliases should be prevented #3334
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -337,6 +337,7 @@ class OverlappingFieldsCanBeMergedTest extends Specification { | |
| def schema = schema(''' | ||
| type Dog { | ||
| nickname: String | ||
| name : String | ||
| } | ||
| type Query { dog: Dog } | ||
| ''') | ||
|
|
@@ -349,6 +350,58 @@ class OverlappingFieldsCanBeMergedTest extends Specification { | |
| errorCollector.getErrors()[0].locations == [new SourceLocation(3, 13), new SourceLocation(4, 13)] | ||
| } | ||
|
|
||
| def 'issue 3332 - Alias masking direct field access non fragment'() { | ||
| given: | ||
| def query = """ | ||
| { dog { | ||
| name: nickname | ||
| name | ||
| }} | ||
| """ | ||
| def schema = schema(''' | ||
| type Dog { | ||
| name : String | ||
| nickname: String | ||
| } | ||
| type Query { dog: Dog } | ||
| ''') | ||
| when: | ||
| traverse(query, schema) | ||
|
|
||
| then: | ||
| errorCollector.getErrors().size() == 1 | ||
| errorCollector.getErrors()[0].message == "Validation error (FieldsConflict@[dog]) : 'name' : 'nickname' and 'name' are different fields" | ||
| errorCollector.getErrors()[0].locations == [new SourceLocation(3, 13), new SourceLocation(4, 13)] | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does NOT fail ; wat ??
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| def 'issue 3332 -Alias masking direct field access non fragment with non null parent type'() { | ||
| given: | ||
| def query = """ | ||
| query GetCat { | ||
| cat { | ||
| foo1 | ||
| foo1: foo2 | ||
| } | ||
| } | ||
| """ | ||
| def schema = schema(''' | ||
| type Query { | ||
| cat: Cat! # non null parent type | ||
| } | ||
| type Cat { | ||
| foo1: String! | ||
| foo2: String! | ||
| } | ||
| ''') | ||
| when: | ||
| traverse(query, schema) | ||
|
|
||
| then: | ||
| errorCollector.getErrors().size() == 1 | ||
| errorCollector.getErrors()[0].message == "Validation error (FieldsConflict@[cat]) : 'foo1' : 'foo1' and 'foo2' are different fields" | ||
| errorCollector.getErrors()[0].locations == [new SourceLocation(4, 17), new SourceLocation(5, 17)] | ||
| } | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fails!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and is now fixed |
||
|
|
||
| def 'conflicting args'() { | ||
| given: | ||
| def query = """ | ||
|
|
||
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 is the bug. When the parent type is a non null (or list) wrapped type - it was not being held in the field+ parent type construct as that BUT it was being compared as if it was a fully unwrapped type