Skip to content

Conversation

@watilde
Copy link

@watilde watilde commented Nov 26, 2025

Description of changes

Add @multiTenant GraphQL transformer directive for automatic tenant-level data isolation in multi-tenant applications.

The transformer:

  • Adds a required tenant field (default: tenantId) to types
  • Injects tenant ID from JWT claims into create/update mutations
  • Filters queries by tenant ID using GSI
  • Validates tenant ownership in update/delete operations
  • Supports custom tenantField and tenantIdClaim parameters
CDK / CloudFormation Parameters Changed

None. This transformer uses existing AppSync resolver and DynamoDB GSI patterns.

Issue #, if available

Primary Issues
Related Issues - amplify-cli
Related Issues - amplify-category-api
Related Issues - amplify-js
Related Issues - amplify-backend

Description of how you validated changes

  • Unit tests: 32 tests passing (transformer logic, VTL generation, schema augmentation)
  • Integration tests: Validates end-to-end transformation with @model directive
  • E2E tests: Full AppSync API deployment with tenant isolation scenarios
  • Manual testing: Verified GSI creation and resolver tenant filtering

Checklist

  • PR description included
  • yarn test passes
  • E2E test run linked
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Any CDK or CloudFormation parameter changes are called out explicitly

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

@watilde watilde requested review from a team as code owners November 26, 2025 09:03
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.

1 participant