-
Notifications
You must be signed in to change notification settings - Fork 329
fix(response caching): nullable fields in entities #8767
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6fdcf2f
fix(response caching): nullable fields in entities
aaronArinder 793bc66
add test to check the generated cache tag with null value inside
bnjjj 89a6071
update docs
bnjjj ec7dc38
update docs
aaronArinder 39d94f9
empty to trigger circle
aaronArinder c03c3c5
empty to trigger circle
aaronArinder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ### Allow nullable `@key`s for response caching | ||
|
|
||
| `@key`s can be nullable, but there was a bug in the response caching feature that blocked nullable `@key`s from being used. This fixes that behavior. Be careful when caching nullable data because it can be null! Docs added to call that out, but be very sure of what you're caching and write cache keys to be as simple and non-nullable as possible. | ||
|
|
||
| By [@aaronArinder](https://github.com/aaronArinder) in https://github.com/apollographql/router/pull/8767 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
apollo-router/tests/integration/fixtures/entity_key_with_null_fields.graphql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| schema | ||
| @link(url: "https://specs.apollo.dev/link/v1.0") | ||
| @link(url: "https://specs.apollo.dev/cacheTag/v0.1", for: EXECUTION) | ||
| @link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION) { | ||
| query: Query | ||
| } | ||
|
|
||
| directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE | ||
|
|
||
| directive @join__field( | ||
| graph: join__Graph | ||
| requires: join__FieldSet | ||
| provides: join__FieldSet | ||
| type: String | ||
| external: Boolean | ||
| override: String | ||
| usedOverridden: Boolean | ||
| ) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION | ||
|
|
||
| directive @join__graph(name: String!, url: String!) on ENUM_VALUE | ||
|
|
||
| directive @join__implements( | ||
| graph: join__Graph! | ||
| interface: String! | ||
| ) repeatable on OBJECT | INTERFACE | ||
|
|
||
| directive @join__directive( | ||
| graphs: [join__Graph!] | ||
| name: String! | ||
| args: join__DirectiveArguments | ||
| ) repeatable on SCHEMA | OBJECT | INTERFACE | FIELD_DEFINITION | ||
|
|
||
| directive @join__type( | ||
| graph: join__Graph! | ||
| key: join__FieldSet | ||
| extension: Boolean! = false | ||
| resolvable: Boolean! = true | ||
| isInterfaceObject: Boolean! = false | ||
| ) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR | ||
|
|
||
| directive @join__unionMember( | ||
| graph: join__Graph! | ||
| member: String! | ||
| ) repeatable on UNION | ||
|
|
||
| directive @link( | ||
| url: String | ||
| as: String | ||
| for: link__Purpose | ||
| import: [link__Import] | ||
| ) repeatable on SCHEMA | ||
|
|
||
| scalar join__FieldSet | ||
| scalar join__DirectiveArguments | ||
| scalar link__Import | ||
|
|
||
| enum join__Graph { | ||
| STUFF @join__graph(name: "stuff", url: "http://localhost:4001") | ||
| STATUS @join__graph(name: "status", url: "http://localhost:4002") | ||
| } | ||
|
|
||
| enum link__Purpose { | ||
| SECURITY | ||
| EXECUTION | ||
| } | ||
|
|
||
| type Query @join__type(graph: STUFF) @join__type(graph: STATUS) { | ||
| getStatus(id: String!): Status @join__field(graph: STUFF) | ||
| } | ||
|
|
||
| type Status | ||
| @join__type(graph: STUFF, key: "id items { id name }") | ||
| @join__type(graph: STATUS, key: "id items { id name }") | ||
| @join__directive( | ||
| graphs: [STATUS] | ||
| name: "federation__cacheTag" | ||
| args: { format: "status-{$key.id}-{$key.name}" } | ||
| ) { | ||
| id: String! | ||
| items: [Item]! | ||
| stuffDetails: String @join__field(graph: STUFF) | ||
| statusDetails: String @join__field(graph: STATUS) | ||
| } | ||
|
|
||
| type Item @join__type(graph: STUFF) @join__type(graph: STATUS) { | ||
| id: String! | ||
| # NOTE: intentionally nullable | ||
| name: String | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.