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

Align SchemaExtenderTest with graphql-js #929

Closed
wants to merge 8 commits into from

Conversation

vhenzl
Copy link
Contributor

@vhenzl vhenzl commented Sep 4, 2021

Follow-up to #928. Aligns SchemaExtenderTest.php with extendSchema-test.js (up to graphql-js v15.5.2).

v14.7 commit

Tests no longer present in extendSchema-test.js have been moved to SchemaExtenderLegacyTest. These are the corresponding commits in graphql-js (relevant also for #928):

Tests in this commit fail because:

v15.0 commit

Reasons, why tests fail (in addition to those mentioned above):

- Fixes asserts and indentation
- Preserves additional tests and changes for repeatable and interfaces implementing interfaces.
- Doesn't add these two missing tests as they tests unsupported lagacy names:
  - it('maintains configuration of the original schema object'
  - it('adds to the configuration of the original schema object'
Tests no longer present in `graphql-js` has been moved to `SchemaExtenderLegacyTest`.
Respective commits that removed them from `extendSchema-test.js` are mentioned in comments.

Tests fail because:
- `repetable` in directives is lost when calling `extend()`
- `Schema::getAstNode()` returns `null` for an extended schema
- scalar types are added to schema automatically even if they are not used in SDL
Reasons, why tests fail (in addition to those mentioned in the previous commit):
- a problem with parsing/printing of types without fields (e.g. `type Query`)
- string comments become multiline (e.g. `"""Comment"""` becomes `"""\nComment\n"""`
- different order of definitions affects `printSchemaChanges()`
- missing `@` in directive name in error messages
@spawnia
Copy link
Collaborator

spawnia commented Sep 6, 2021

Awesome work so far. What is your plan for integrating those changes?

@vhenzl
Copy link
Contributor Author

vhenzl commented Sep 10, 2021

What is your plan for integrating those changes?

I'm not quite sure yet. I want to have a look at print() and printSchema() first. If I can get these to handle empty types and string blocks correctly, that would resolve a significant number of test failures. The other thing that accounts for a big amount of failing tests is astNode and extensionASTNodes not being properly set/copied, which shouldn't be hard to fix. With these two problems resolved, I believe most of this and also #928 should be possible to merge up to v15.5.

@spawnia
Copy link
Collaborator

spawnia commented Sep 10, 2021

If small pull requests emerge, that would be great. If not, I am also fine with a large pull request that fixes it all.

@spawnia
Copy link
Collaborator

spawnia commented May 29, 2022

Thank you for this. Apart from #1140, we are now in sync.

@spawnia spawnia closed this May 29, 2022
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.

2 participants