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

enhance(printSchemaWithDirectives): for code first schemas #2391

Merged
merged 7 commits into from
Dec 22, 2020

Conversation

yaacovCR
Copy link
Collaborator

@yaacovCR yaacovCR commented Dec 20, 2020

GraphQL directives defined without an astNode should be converted to as astNode/print.

GraphQL directives found in extensions should be converted to astNodes/print.

@changeset-bot
Copy link

changeset-bot bot commented Dec 20, 2020

🦋 Changeset detected

Latest commit: 3b054ff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@graphql-tools/stitching-directives Patch
@graphql-tools/utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@theguild-bot
Copy link
Collaborator

theguild-bot commented Dec 20, 2020

The latest changes of this PR are available as alpha in npm (based on the declared changesets):

@graphql-tools/batch-delegate@7.0.2-alpha-521aa47e.0
@graphql-tools/batch-execute@7.0.1-alpha-521aa47e.0
@graphql-tools/delegate@7.0.9-alpha-521aa47e.0
@graphql-tools/graphql-tag-pluck@6.3.1-alpha-521aa47e.0
graphql-tools@7.0.3-alpha-521aa47e.0
@graphql-tools/links@7.0.4-alpha-521aa47e.0
@graphql-tools/load@6.2.6-alpha-521aa47e.0
@graphql-tools/apollo-engine-loader@6.2.6-alpha-521aa47e.0
@graphql-tools/code-file-loader@6.2.7-alpha-521aa47e.0
@graphql-tools/git-loader@6.2.6-alpha-521aa47e.0
@graphql-tools/github-loader@6.2.6-alpha-521aa47e.0
@graphql-tools/graphql-file-loader@6.2.7-alpha-521aa47e.0
@graphql-tools/json-file-loader@6.2.7-alpha-521aa47e.0
@graphql-tools/module-loader@6.2.6-alpha-521aa47e.0
@graphql-tools/prisma-loader@6.2.8-alpha-521aa47e.0
@graphql-tools/url-loader@6.7.2-alpha-521aa47e.0
@graphql-tools/merge@6.2.7-alpha-521aa47e.0
@graphql-tools/mock@7.0.1-alpha-521aa47e.0
@graphql-tools/node-require@6.2.5-alpha-521aa47e.0
@graphql-tools/relay-operation-optimizer@6.3.1-alpha-521aa47e.0
@graphql-tools/resolvers-composition@6.2.6-alpha-521aa47e.0
@graphql-tools/schema@7.1.3-alpha-521aa47e.0
@graphql-tools/stitch@7.1.7-alpha-521aa47e.0
@graphql-tools/stitching-directives@1.0.1-alpha-521aa47e.0
@graphql-tools/utils@7.1.7-alpha-521aa47e.0
@graphql-tools/wrap@7.0.5-alpha-521aa47e.0

so you can use mapSchema within printSchemaWithDirectives without going into infinite recursion
@yaacovCR
Copy link
Collaborator Author

@ardatan @kamilkisiela

Would appreciate when you have time to take a look at these changes.

Motivation for these changes is to allow code-first schemas to use directives within extensions so they can embed metadata for stitching. These changes will allow printing of directive definitions that are without SDL and directive uses embedded within extensions.

There are some changes here to printSchemaWithDirectives that I am not completely sure about => specifically the use of block: true to force comments to be block strings, this preserves old behavior, but I am not sure exactly whether the prior logic was always to use block strings for comments or only under some scenarios.

I also ended up fixing an infinite recursion issue with fixSchemaAst when using mapSchema within printSchemaWithDirectives. I ended up not calling mapSchema so this fix isn't strictly required, but it seemd like a good idea to keep it in.

@yaacovCR yaacovCR merged commit 3d0c50a into master Dec 22, 2020
@yaacovCR yaacovCR deleted the code-first-support branch December 22, 2020 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants