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

Fix @_required directive when the schema is available #3685

Merged
merged 4 commits into from
Oct 3, 2024

Conversation

AndrewIngram
Copy link
Contributor

If graphcache was configured with the full schema, the @_required directive would be ignored on nullable fields. This diff tweaks the condition to fix that behaviour.

If graphcache was configured with the full schema, the `@_required` directive would be ignored on nullable fields. This diff tweaks the condition to fix that behaviour.
Copy link

changeset-bot bot commented Oct 2, 2024

🦋 Changeset detected

Latest commit: a910c50

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

This PR includes changesets to release 1 package
Name Type
@urql/exchange-graphcache Minor

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

Copy link
Collaborator

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

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

Mind adding a test and changeset?

@AndrewIngram
Copy link
Contributor Author

Should be able to, will actually need to check out the code first 😅

Can I just get confirmation that this is actually fixing unintended behaviour? The docs are a little confusing on this point, even though required seems most useful when there's a schema saying a field is optional:

Graphcache comes with two directives built-in by default. The optional and required directives. These directives can be used as an alternative to the Schema Awareness feature’s ability to generate partial result

@AndrewIngram
Copy link
Contributor Author

AndrewIngram commented Oct 2, 2024

Okay, should be good to go 🤞🏻

@kitten
Copy link
Member

kitten commented Oct 3, 2024

Can I just get confirmation that this is actually fixing unintended behaviour?

I'd say it's unintended behaviour, yes. It's definitely not something we had in mind, since the directives were mostly tested as an alternative to schema awareness.

@JoviDeCroock JoviDeCroock merged commit ca0adea into urql-graphql:main Oct 3, 2024
19 checks passed
@github-actions github-actions bot mentioned this pull request Sep 24, 2024
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