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: πŸ› generate array/non-scalar fields #2627

Conversation

kekami
Copy link
Contributor

@kekami kekami commented Jun 14, 2024

use non-mapped table name to generate array/non-scalar fields on relational queries

βœ… Closes: #2581

Description of changes

Fix issue where the generated AppSync DataResolverFn for relational SQL queries did not have arrayFields and nonScalarFields correctly set, e.g.

#set( $lambdaInput.args.metadata.arrayFields = [] )
#set( $lambdaInput.args.metadata.nonScalarFields = [] )

This was due to using the incorrect (mapped) tableName when generating these fields, e.g. tasks instead of Task

 constructArrayFieldsStatement(tableName, ctx),
 constructNonScalarFieldsStatement(tableName, ctx),

Issue #, if available

#2581

Description of how you validated changes

Unsure if it could be tested in a better way

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

use non-mapped table name to generate array/non-scalar fields on
relational queries

βœ… Closes: aws-amplify#2581
@kekami kekami requested a review from a team as a code owner June 14, 2024 13:13
update snapshots for graphql-name-mapping-transformer
add tests to ensure array/non-scalar fields are properly set on
relational objects
@kekami kekami requested a review from a team as a code owner June 21, 2024 19:41
@kekami kekami force-pushed the graphql-relational-transformer/fix-non-scalar-fields branch from aa59dc4 to 00f61a9 Compare June 21, 2024 19:46
@palpatim palpatim self-requested a review July 3, 2024 16:27
@palpatim
Copy link
Member

palpatim commented Jul 3, 2024

Great find! Thanks for the troubleshooting and especially the fix with tests. Reviewing this now.

@palpatim
Copy link
Member

palpatim commented Jul 3, 2024

Thanks again for this PR! I cherry picked your commits to #2689 so we could more easily resolve conflicts / rebase against main, and run E2E tests. It is now merged, and will be released during our next regular release.

@palpatim palpatim closed this Jul 3, 2024
@kekami
Copy link
Contributor Author

kekami commented Jul 3, 2024

Thanks again for this PR! I cherry picked your commits to #2689 so we could more easily resolve conflicts / rebase against main, and run E2E tests. It is now merged, and will be released during our next regular release.

Thank you, happy to help πŸ™Œ

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.

SQLSchema - Error: "contains" operator on scalar field is not allowed in auth filter
2 participants