Skip to content

Fix schema validation false positives and add engine-conditional rules#4480

Open
kddejong wants to merge 3 commits intoaws-cloudformation:mainfrom
kddejong:fix/schema-validation-improvements
Open

Fix schema validation false positives and add engine-conditional rules#4480
kddejong wants to merge 3 commits intoaws-cloudformation:mainfrom
kddejong:fix/schema-validation-improvements

Conversation

@kddejong
Copy link
Copy Markdown
Contributor

Summary

Fix several schema validation false positives and add new engine-conditional rules for RDS DBInstance properties.

Schema fixes

  • Add maxUniqueItems JSON Schema keyword for arrays where duplicates are allowed but the unique count is limited (e.g. CloudWatch Alarm actions)
  • Replace maxItems with maxUniqueItems for CloudWatch Alarm AlarmActions, OKActions, and InsufficientDataActions
  • Set uniqueItems to true for Lambda Function Layers
  • Remove maxItems from Connect RoutingProfile QueueConfigs (API batch limit, not resource limit)
  • Remove stale enums from EC2 EIP Domain, VPNGateway Type, and CustomerGateway Type
  • Remove stale enum from SES ConfigurationSetEventDestination DimensionValueSource and add manual patch with both camelCase and SCREAMING_SNAKE_CASE values
  • Remove stale pattern from SecurityHub AutomationRule MapFilter/Value
  • Fix smithy script to clean up stale files when no patches remain

New rules

  • E3720: Validate StorageEncrypted is required when KmsKeyId is specified for non-custom engine RDS DBInstances
  • E3721: Validate ReplicaMode enum values for Oracle and Db2 engines
  • W3699: Warn when ReplicaMode is specified for non-Oracle/Db2 engines (dead config, silently ignored)
  • W3700: Warn when EIP Domain has non-standard values (silently converted to vpc)

Smithy automation

  • Add exceptions for properties where smithy enums are too restrictive or incorrect for CloudFormation
  • Clean up stale smithy.json files that only contained redundant patches

Testing

  • Added unit tests for all new rules
  • Added unit tests for maxUniqueItems keyword
  • All existing tests pass

Schema fixes:
- Add maxUniqueItems JSON Schema keyword for arrays where duplicates are
  allowed but the unique count is limited (e.g. CloudWatch Alarm actions)
- Replace maxItems with maxUniqueItems for CloudWatch Alarm AlarmActions,
  OKActions, and InsufficientDataActions
- Set uniqueItems to true for Lambda Function Layers
- Remove maxItems from Connect RoutingProfile QueueConfigs (API batch
  limit, not resource limit)
- Remove stale enums from EC2 EIP Domain, VPNGateway Type, and
  CustomerGateway Type
- Remove stale enum from SES ConfigurationSetEventDestination
  DimensionValueSource and add manual patch with both camelCase and
  SCREAMING_SNAKE_CASE values
- Remove stale pattern from SecurityHub AutomationRule MapFilter Value
- Fix smithy script to clean up stale files when no patches remain

New rules:
- E3720: Validate StorageEncrypted is required when KmsKeyId is specified
  for non-custom engine RDS DBInstances
- E3721: Validate ReplicaMode enum values for Oracle and Db2 engines
- W3699: Warn when ReplicaMode is specified for non-Oracle/Db2 engines
  (dead config, silently ignored)
- W3700: Warn when EIP Domain has non-standard values (silently
  converted to vpc)

Smithy automation:
- Add exceptions for properties where smithy enums are too restrictive
  or incorrect for CloudFormation
- Clean up stale smithy.json files that only contained redundant patches
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.47%. Comparing base (1077daa) to head (ce9daee).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4480      +/-   ##
==========================================
+ Coverage   93.44%   93.47%   +0.03%     
==========================================
  Files         455      459       +4     
  Lines       14943    15022      +79     
  Branches     2898     2906       +8     
==========================================
+ Hits        13963    14042      +79     
  Misses        601      601              
  Partials      379      379              
Flag Coverage Δ
unittests 93.47% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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