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(amplify-codegen): support multiple indexes on the same field in introspection schema #879

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

sundersc
Copy link
Contributor

@sundersc sundersc commented Sep 17, 2024

Description of changes

Fixes a bug where multiple indexes on a field is not correctly represented on the generated model introspection schema.

Codegen Paramaters Changed or Added

No.

Issue #, if available

Fixes aws-amplify/amplify-category-api#2815

Description of how you validated changes

  • Unit tests
  • Manual test

Note

Manual testing: I've tested the fix on a sample Gen2 app using NPM overrides pointing to the local packaged module.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • Breaking changes to existing customers are released behind a feature flag or major version update
  • Changes are tested using sample applications for all relevant platforms (iOS/android/flutter/Javascript) that use the feature added/modified
  • Changes are tested on windows. Some Node functions (such as path) behave differently on windows.
  • Changes adhere to the GraphQL Spec and supports the GraphQL types type, input, enum, interface, union and scalar types.

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

@sundersc sundersc requested a review from a team as a code owner September 17, 2024 00:02
}, {} as Record<string, CodeGenDirective[]>);

const keyList: CodeGenDirective[] = [];
Object.entries(indexMap).forEach(([fieldName, directives]) => {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Why change this from a map to a forEach?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.map returns a new array, whereas .forEach doesn't return anything. Since the refactored code doesn't rely on the returned array, .forEach is a better fit here.

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.

AmplifyOutputs.json ignores Multiple Secondary Index Queries using the same SecondaryIndex Field
3 participants