Skip to content

Fix SameResponseShape definition #451

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

Merged
merged 4 commits into from
Jun 10, 2018
Merged

Fix SameResponseShape definition #451

merged 4 commits into from
Jun 10, 2018

Conversation

matprec
Copy link
Contributor

@matprec matprec commented May 29, 2018

For motivation, see discussion in #450

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

{mergedSet} including visiting fragments and inline fragments.
* Given each pair of members {subfieldA} and {subfieldB} in {fieldsForName}:
* If SameResponseShape(subfieldA, subfieldB)} is false, return false,
otherwise continue.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to write otherwise continue.
Example:
http://facebook.github.io/graphql/draft/#AreTypesCompatible()

If variableType is NOT a non‐null type, return false

* {SameResponseShape(subfieldA, subfieldB)} must be true.
* If {typeA} and {typeB} are the same type return true, otherwise return
false.
* If {typeA} and {typeB} are both composite types:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest changing it to:

If {typeA} or {typeB} is not a composite type, return false

It allows moving subsequent steps on the top level and also removing final:

Return false

@IvanGoncharov
Copy link
Member

To achieve full consistency I would also change:

{typeA} and {typeB} must both be Non-Null.

to

If {typeA} or {typeB} is not a Non-Null, return false.

Same here:

{typeA} and {typeB} must both be List.

@matprec
Copy link
Contributor Author

matprec commented May 29, 2018

Addressed review!

* Assert: {typeA} and {typeB} are both composite types.
* If {typeA} and {typeB} are the same type return true, otherwise return
false.
* If {typeA} and {typeB} is not a composite type, return false.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be or

* Let {mergedSet} be the result of adding the selection set of {fieldA} and
the selection set of {fieldB}.
* Let {fieldsForName} be the set of selections with a given response name in
{mergedSet} including visiting fragments and inline fragments.
* Given each pair of members {subfieldA} and {subfieldB} in {fieldsForName}:
* {SameResponseShape(subfieldA, subfieldB)} must be true.
* If SameResponseShape(subfieldA, subfieldB)} is false, return false.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed the curly brace here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, fixed!

@leebyron
Copy link
Collaborator

Great catch and fix! Thanks for your help

@leebyron leebyron added 🤷‍♀️ Ambiguity An issue/PR which identifies or fixes spec ambiguity and removed clarification labels Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤷‍♀️ Ambiguity An issue/PR which identifies or fixes spec ambiguity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants