Skip to content

Commit

Permalink
catch common resource schema issues (aws-cloudformation#668)
Browse files Browse the repository at this point in the history
continuing aws-cloudformation#663

readOnlyProperties overlapping with required:
AWS::CodeArtifact::Repository.DomainName
AWS::MWAA::Environment.Name
  • Loading branch information
PatMyron authored and kddejong committed Oct 24, 2022
1 parent 772abe2 commit 15d8ed9
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/rpdk/core/data_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,17 @@ def load_resource_spec(resource_spec_file): # pylint: disable=R0912 # noqa: C90
list_options,
)

if set(resource_spec.get("readOnlyProperties", [])) & set(
resource_spec.get("createOnlyProperties", [])
) or set(resource_spec.get("readOnlyProperties", [])) & set(
resource_spec.get("writeOnlyProperties", [])
):
read_only_properties_intersection = set(
resource_spec.get("readOnlyProperties", [])
) & (
set(resource_spec.get("createOnlyProperties", []))
| set(resource_spec.get("writeOnlyProperties", []))
| {"/properties/" + s for s in resource_spec.get("required", [])}
)
if read_only_properties_intersection:
LOG.warning(
"readOnlyProperties cannot be specified by customers and should not overlap with writeOnlyProperties or createOnlyProperties"
"readOnlyProperties cannot be specified by customers and should not overlap with writeOnlyProperties, createOnlyProperties, or required: %s",
read_only_properties_intersection,
)

for handler in resource_spec.get("handlers", []):
Expand Down

0 comments on commit 15d8ed9

Please sign in to comment.