Skip to content

Conversation

@ahmedhamouda78
Copy link
Member

Problem

The Amplify Data Schema Builder was missing support for GSI (Global Secondary Index) projection types, which are essential for optimizing DynamoDB query performance and cost by controlling which attributes are projected into secondary indexes.

Issue number, if available:

#604

Changes

  • Added GSIProjectionType type supporting 'KEYS_ONLY', 'INCLUDE', and 'ALL' projection types
  • Extended ModelIndexData interface with projectionType and nonKeyAttributes fields
  • Implemented .projection() method on ModelIndexType with type-safe overloads
  • Added support for specifying non-key attributes when using 'INCLUDE' projection type
  • Updated SchemaProcessor to handle projection configuration in generated schemas
  • Added comprehensive test coverage for all projection types

Corresponding docs PR, if applicable:

Validation

  • Added unit tests
  • Tests validate schema generation for all projection types (KEYS_ONLY, INCLUDE, ALL)
  • Snapshot tests ensure consistent schema output
  • Type-level validation ensures correct usage patterns at compile time

Checklist

  • If this PR includes a functional change to the runtime or type-level behavior of the code, I have added or updated automated test coverage for this change. (see Testing Strategy README)
  • If this PR requires a docs update, I have linked to that docs PR above.

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

@ahmedhamouda78 ahmedhamouda78 requested a review from a team as a code owner October 20, 2025 17:16
@changeset-bot
Copy link

changeset-bot bot commented Oct 20, 2025

🦋 Changeset detected

Latest commit: c0c4cb5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/data-schema Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

2 participants