Fix query from AppSync with an empty filter object#61
Merged
Cole-Greer merged 6 commits intoaws:mainfrom Feb 3, 2025
Merged
Conversation
Build the query/mutation's selection set using the `graphql` utilities, instead of building manually. This will avoid any edge cases with the provided arguments. The schema is assumed to be valid: validation should be taken care of ahead of time in `schemaModelValidator` and we also currently do not define the built-in directives (e.g. `@id`, `@relationship`) required to make it a valid schema. - break out lookup functions for type/field definitions - update `outputReference` resolvers - add unit tests - fix query result tests that were sensitive to object key order (use `toEqual` instead of strict JSON string equality) - also check output file size of `.cjs` resolver in test `Case01.02` - fix running test `Case01.04` (use `.cjs` extension) closes aws#44
Resolve an "unexpected EOF" error from `gql`
(as a result of the resolver changes for queries with an empty filter object)
Contributor
|
Hi @danielfinke thanks for all of your recent contributions. This one is a bit more complex than the others so will take a bit more time to review, but I hope to review it this week. |
Contributor
|
Hello Daniel, thank you for submitting these changes. The team will look at them soon. |
Contributor
Author
|
@andreachild @AndreaNassisi no problem 🙂 I am assembling more PRs as well, no rush |
…ith-an-empty-filter-object
danielfinke
added a commit
to danielfinke/amazon-neptune-for-graphql
that referenced
this pull request
Jan 30, 2025
Wrap the JSON in single quotes instead of backticks to reduce the escape sequence surface area. Escape any single quotes in the stringified JSON. This handles single and double quotes and backticks in the input schema's scalar, field/type/etc. descriptions. - add test `Case03.02` to check output for schema with string delimiters - update other `outputReference` resolvers - add templates to lint check - fix resulting ESLint errors in templates - exclude output from ESLint rules (hide errors for those files when using editor integrations) copied changes from aws#61: - fix query result tests that were sensitive to object key order (use `toEqual` instead of strict JSON string equality) - also check output file size of `.cjs` resolver in test `Case01.02` - fix running test `Case01.04` (use `.cjs` extension) closes aws#65
andreachild
reviewed
Jan 30, 2025
This was referenced Jan 30, 2025
danielfinke
added a commit
to danielfinke/amazon-neptune-for-graphql
that referenced
this pull request
Jan 31, 2025
Callers can now pass in GraphQL ASTs directly. Saves a redundant print/parse in `resolveGraphDBQueryFromAppSyncEvent`. For backwards-compatibility, callers *can* continue to pass in a query string. - update `outputReference` resolvers - update tests to pass in ASTs instead of strings see aws#61 (comment)
Callers can now pass in GraphQL ASTs directly. Saves a redundant print/parse in `resolveGraphDBQueryFromAppSyncEvent`. For backwards-compatibility, callers *can* continue to pass in a query string. - update `outputReference` resolvers - update tests to pass in ASTs instead of strings see aws#61 (comment)
andreachild
reviewed
Jan 31, 2025
andreachild
reviewed
Jan 31, 2025
Contributor
|
LGTM thanks for your patience and taking feedback into consideration |
andreachild
reviewed
Jan 31, 2025
Cole-Greer
approved these changes
Feb 3, 2025
Contributor
Cole-Greer
left a comment
There was a problem hiding this comment.
Thanks @danielfinke, LGTM
danielfinke
added a commit
to danielfinke/amazon-neptune-for-graphql
that referenced
this pull request
Feb 9, 2025
Also fix mistyped return annotation on `resolveGraphDBQuery`, my bad
danielfinke
added a commit
to danielfinke/amazon-neptune-for-graphql
that referenced
this pull request
Feb 10, 2025
Also fix mistyped return annotation on `resolveGraphDBQuery`, my bad
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue #, if available: #44
Description of changes:
Build the query/mutation's selection set using the
graphqlutilities, instead of building manually. This will avoid any edge cases with the provided arguments. The schema is assumed to be valid: validation should be taken care of ahead of time inschemaModelValidatorand we also currently do not define the built-in directives (e.g.@id,@relationship) required to make it a valid schema.outputReferenceresolverstoEqualinstead of strict JSON string equality).cjsresolver in testCase01.02Case01.04(use.cjsextension)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.