Repository navigation
fix: Validate --registry-schemas types against their schema again - #4763
Conversation
|
Hi maintainers, could someone please triage this PR and review the proposed fix when available? The change addresses the regression where types supplied through I also noticed that GitHub currently shows no check runs for this commit. Could you advise whether CI needs to be triggered or configured for this PR? Thanks for your time. |
Since 1.43.0, get_resource_schemas_by_regions only yields schemas for types found in a region's provider mapping. Types loaded with --registry-schemas are never in that mapping, so every region was skipped and E3002/E3003/E3012 (Properties), E1010 (GetAtt), GetAttFormat and RefFormat received no schema for them. E3006 still passed because get_resource_types includes the registry types. Look up registry types first, before the type is normalized, the same way get_resource_schema does, and group all requested regions under the one registry schema. Fixes aws-cloudformation#4762 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5ab26a3 to
78f5999
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4763 +/- ##
=======================================
Coverage 94.66% 94.67%
=======================================
Files 439 439
Lines 15963 15967 +4
Branches 3091 3093 +2
=======================================
+ Hits 15112 15116 +4
Misses 468 468
Partials 383 383
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Issue #, if available: Fixes #4762
Description of changes:
Since 1.43.0 (#4319, hash-based schema storage),
get_resource_schemas_by_regionsonly yields a schema when the type is in a region's provider mapping. Types loaded with--registry-schemasare never in that mapping, so every region is skipped and the rules that use it (Properties for E3002/E3003/E3012, GetAtt for E1010, GetAttFormat and RefFormat) get no schema for those types. E3006 still passes becauseget_resource_typesincludes the registry types, so the template looks valid.This looks registry types up first, before the type is normalized, which is the order
get_resource_schemaalready uses (so a registry::MODULEtype keeps its own schema), and groups all requested regions under the one registry schema.With the reproduction from the issue,
cfn-lint --registry-schemas schemas -- example.yamlnow reports:On main it reports nothing and exits 0.
Tests:
TestManagerGetResourceSchemasByRegions(test/unit/module/schema/test_manager.py): a registry type, a registry::MODULEtype, a registry type removed with--override-spec, and an unknown type.TestLintRegistrySchemas(test/unit/module/test_api.py): lints throughlint()withregistry_schemasand asserts E1010, E3002 and E3003, and checks that the existinggood/schema_resource.yamlfixture has no findings.pytest test/passes (2951 unit, 27 integration), and ruff, isort, mypy and bandit are clean.I used Claude Code (AI) to help investigate and write this change, and reviewed and tested it before submitting.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
🤖 Generated with Claude Code