Skip to content

Conversation

@yaacovCR
Copy link
Contributor

@yaacovCR yaacovCR commented Nov 25, 2024

Is it legal to use “extend schema” if the schema definition is omitted and the default types could have been used?

@yaacovCR yaacovCR requested a review from a team as a code owner November 25, 2024 22:24
@netlify
Copy link

netlify bot commented Nov 25, 2024

Deploy Preview for compassionate-pike-271cb3 ready!

Name Link
🔨 Latest commit d430324
🔍 Latest deploy log https://app.netlify.com/sites/compassionate-pike-271cb3/deploys/6744f931c82d3f0008eded47
😎 Deploy Preview https://deploy-preview-4300--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions
Copy link

Hi @yaacovCR, I'm @github-actions bot happy to help you with this PR 👋

Supported commands

Please post this commands in separate comments and only one per comment:

  • @github-actions run-benchmark - Run benchmark comparing base and merge commits for this PR
  • @github-actions publish-pr-on-npm - Build package from this PR and publish it on NPM

@JoviDeCroock
Copy link
Member

JoviDeCroock commented Nov 26, 2024

I am not sure I understand the question about the legality of this operation? If your question is whether it's fine to leverage extend Schema without there being an explicit Schema definition I think that's legal yes, as the Schema definition in both SDL as well as Code first is often implicit so I'd see this as a safe way of overriding the Query default type.

All though this does beg the question where the implicit schema type is Schema { query: Query } and we change it to Schema { query: MyQuery } over a type-extension. That's potentially a footgun in fully removing all the related fields hat are defined in Query.

The spec does hint that it should be explicitly defined so in following the spec to the letter here I would personally not start supporting this due to the spec as well as the aforementioned footgun.

@yaacovCR yaacovCR added the PR: bug fix 🐞 requires increase of "patch" version number label Nov 26, 2024
@yaacovCR
Copy link
Contributor Author

That's a great catch on the spec requiring the schema to be defined! :) I think we can close this.

@yaacovCR yaacovCR closed this Nov 26, 2024
@yaacovCR yaacovCR deleted the fix-for-root-type-mixture branch November 26, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: bug fix 🐞 requires increase of "patch" version number

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants