Skip to content

Comments

fix: consolidate Resources pattern properties to fix Typescript generation bug#13194

Merged
czubocha merged 1 commit intomainfrom
sc-3713
Jan 7, 2026
Merged

fix: consolidate Resources pattern properties to fix Typescript generation bug#13194
czubocha merged 1 commit intomainfrom
sc-3713

Conversation

@czubocha
Copy link
Contributor

@czubocha czubocha commented Dec 22, 2025

Closes #13183


Summary

This Pull Request updates the AWS provider JSON schema in the Serverless framework to consolidate the handling of resource names and Fn::ForEach macros. This is done to work around a limitation in the json-schema-to-typescript library, ensuring better support for these patterns.

Main Changes:

  • Consolidated patternProperties: Combined two patterns (^[a-zA-Z0-9]{1,255}$ and ^Fn::ForEach::[a-zA-Z0-9]+$) into a single pattern ^([a-zA-Z0-9]{1,255}|Fn::ForEach::[a-zA-Z0-9]+)$.
  • Enhanced validation schema: Added support for a oneOf validation to accommodate both standard resource patterns and Fn::ForEach macros.
  • Improved compatibility: Resolved a known limitation in json-schema-to-typescript that restricted the use of multiple patternProperty definitions.

This change is specific to improving JSON schema compatibility and does not affect runtime behavior.

@Mmarzex
Copy link
Contributor

Mmarzex commented Dec 22, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates two separate patternProperties patterns in the AWS CloudFormation Resources schema into a single pattern to work around a limitation in the json-schema-to-typescript library that prevents it from handling multiple pattern properties correctly.

Key Changes:

  • Merged resource name pattern (^[a-zA-Z0-9]{1,255}$) and Fn::ForEach macro pattern (^Fn::ForEach::[a-zA-Z0-9]+$) into one consolidated regex pattern
  • Wrapped both resource schemas in a oneOf array to maintain support for both resource types
  • Added inline documentation explaining the workaround

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@czubocha czubocha requested a review from eahefnawy December 22, 2025 22:53
@jakeleventhal
Copy link

what exactly is this waiting on?

@czubocha czubocha merged commit 1eb03d3 into main Jan 7, 2026
16 checks passed
@czubocha czubocha deleted the sc-3713 branch January 7, 2026 10:03
@github-actions github-actions bot locked and limited conversation to collaborators Jan 7, 2026
czubocha referenced this pull request in serverless/typescript Jan 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression in type definitions for resources

4 participants