Conversation
…58k → ~15k files) (#3508)
…tput path (#3510) ## Summary Sanitizes database column names and enum type names in the TypeScript data schema output path, matching the existing `cleanMappedName` behavior in the GraphQL-SDL output path. ## Problem The TypeScript schema generator passed raw database column names and enum type names directly to `ts.factory.createIdentifier()`, which emits them as bare JavaScript identifiers without any sanitization. Names containing special characters (parentheses, brackets, quotes, etc.) could produce invalid or unsafe TypeScript output. ## Changes - Add `sanitizeIdentifier()` helper that strips leading non-alphabetic characters and replaces non-alphanumeric characters with underscores (matching `cleanMappedName` from the GraphQL-SDL path) - Use `createStringLiteral` instead of `createIdentifier` for field property names in `createProperty()` - Use `createStringLiteral` instead of `createIdentifier` for enum type property names in `createEnums()` - Sanitize enum type names in `a.ref()` calls for consistency between the enum definition and its references - Fix enum deduplication logic to work with `StringLiteral` property names (uses `.text` instead of `.escapedText`) ## Defense in Depth This is a defense-in-depth measure. The TS output path should apply the same sanitization as the GraphQL-SDL path to ensure consistent, safe output regardless of database column naming. ## Testing - Added 5 new unit tests verifying: - Column names with shell metacharacters are sanitized - Column names with brackets/special chars are sanitized - Enum type names with special characters are sanitized - Fallback names are generated for all-special-character column names - Property keys are emitted as string literals - Updated 16 existing snapshots to reflect the new quoted property key format - All 100 tests in the package pass
Simone319
approved these changes
Jul 10, 2026
sarayev
approved these changes
Jul 10, 2026
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.
Release PR
Merges
mainintoreleaseto trigger the next npm publish.E2E status: All tests passed on
run-e2e-beta-sql-layer(batchamplify-category-api-e2e-workflow:8605cb73-2c55-4547-865d-fd840697f807, 195/196 green — onlycleanup_e2e_resourcesfailed which is post-test cleanup, not an actual test).yarn trigger-releasefrom local clone