Title: Apollo Persisted Query Support & the Apollo reference implementation · Issue #2395 · graphql-java/graphql-java · GitHub
Open Graph Title: Apollo Persisted Query Support & the Apollo reference implementation · Issue #2395 · graphql-java/graphql-java
X Title: Apollo Persisted Query Support & the Apollo reference implementation · Issue #2395 · graphql-java/graphql-java
Description: There's an issue at over at the DGS framework: Netflix/dgs-framework#50 for adding support for the PreparsedDocumentProvider. I'd like to take this a bit further and add a module for supporting Apollo Persisted Queries with spring observ...
Open Graph Description: There's an issue at over at the DGS framework: Netflix/dgs-framework#50 for adding support for the PreparsedDocumentProvider. I'd like to take this a bit further and add a module for supporting Apo...
X Description: There's an issue at over at the DGS framework: Netflix/dgs-framework#50 for adding support for the PreparsedDocumentProvider. I'd like to take this a bit further and add a module for suppor...
Opengraph URL: https://github.com/graphql-java/graphql-java/issues/2395
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Apollo Persisted Query Support & the Apollo reference implementation ","articleBody":"There's an issue at over at the DGS framework: https://github.com/Netflix/dgs-framework/issues/50 for adding support for the `PreparsedDocumentProvider`. I'd like to take this a bit further and add a module for supporting Apollo Persisted Queries with spring observability in the DGS framework.\r\n\r\nI found a few notable details while experimenting with this in the DGS framework and thought I should raise them here.\r\n\r\n#### Apollo Persisted Query support should validate the query hash\r\nThe Apollo implementation(and the in-house implementation at NYT) check that the incoming query hash matches the SHA-256 checksum of the query. Ofc this only happens for query register operations, i.e. when both a hash and query are present.\r\n```json\r\n {\r\n \"query\": \"{__typename}\",\r\n \"extensions\":{\r\n \"persistedQuery\":{\r\n \"version\":1,\r\n \"sha256Hash\":\"fcf31818e50ac3e818ca4bdbc433d6ab73176f0b9d5f9d5ad17e200cdab6fba4\"\r\n }\r\n }\r\n }\r\n```\r\nIf the computed checksum and provided SHA don't match, an error should be thrown indicating so. [ApolloPersistedQuerySupport](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/execution/preparsed/persisted/ApolloPersistedQuerySupport.java) does not do this.\r\n\r\nPerhaps this should be a config option to avoid a breaking change? Or also to allow people to choose if they want this.\r\nHere's an example from my experiments last week.\r\n```json\r\n{\r\n \"errors\": [\r\n {\r\n \"message\": \"provided SHA does not match query\",\r\n \"locations\": [],\r\n \"extensions\": {\r\n \"classification\": \"BAD_REQUEST\"\r\n }\r\n }\r\n ]\r\n}\r\n```\r\n#### Nice to have: Throw Persisted Query not supported error\r\nIf a client passes APQ to a GraphQL that does not support it, it'd be nice to be able to configure the GraphQL service to throw an error, e.g. [requestPipeline.ts#L164](https://github.com/apollographql/apollo-server/blob/0aa0e4b20ef97576ce92733698a7842b61d8280e/packages/apollo-server-core/src/requestPipeline.ts#L164).\r\nI'm not sure where I'd put this.\r\n\r\n#### InMemoryPersistedQueryCache that registers incoming queries (less important so likely will drop)\r\nThe example [InMemoryPersistedQueryCache.java](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/execution/preparsed/persisted/InMemoryPersistedQueryCache.java#L16) doesn't have a way to push queries into the cache from the request. Would we be open to modify or add a new base impl that does register queries when both a query and hash are present?\r\n\r\nThat's all. I would really appreciate some feedback, yays or nays. Thank You, have a great day!","author":{"url":"https://github.com/jregistr","@type":"Person","name":"jregistr"},"datePublished":"2021-06-22T17:59:22Z","url":"https://github.com/graphql-java/graphql-java/issues/2395"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:96bc5c75-a521-d046-15fd-3e2212127cc5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C3E2:134693:2D807:3C09E:6B017C5A |
| html-safe-nonce | 63c601e34cc87d10cbd7782404174ea1b0cc74da58afcc54386cd95e05527184 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0UyOjEzNDY5MzoyRDgwNzozQzA5RTo2QjAxN0M1QSIsInZpc2l0b3JfaWQiOiI5MjIxMTI1MTQ3OTgzOTY5MzcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3ccd1eeb24ad532bf578b589c7fa6a81bcc6249c50242f834c46cd4de94681f6 |
| hovercard-subject-tag | issue:927497121 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/graphql-java/graphql-java/2395/issue_layout |
| twitter:image | https://opengraph.githubassets.com/894e8abd1f6b8db4bf3d0be38f39ce0749411db1178b0e5041d384e4aa7da8ae/graphql-java/graphql-java/issues/2395 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/894e8abd1f6b8db4bf3d0be38f39ce0749411db1178b0e5041d384e4aa7da8ae/graphql-java/graphql-java/issues/2395 |
| og:image:alt | There's an issue at over at the DGS framework: Netflix/dgs-framework#50 for adding support for the PreparsedDocumentProvider. I'd like to take this a bit further and add a module for supporting Apo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jregistr |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/graphql-java/graphql-java git https://github.com/graphql-java/graphql-java.git |
| octolytics-dimension-user_id | 14289921 |
| octolytics-dimension-user_login | graphql-java |
| octolytics-dimension-repository_id | 38602457 |
| octolytics-dimension-repository_nwo | graphql-java/graphql-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38602457 |
| octolytics-dimension-repository_network_root_nwo | graphql-java/graphql-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width