Skip to content

Commit

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

readOnlyProperties overlapping with required:
AWS::CodeArtifact::Repository.DomainName
AWS::MWAA::Environment.Name
  • Loading branch information
PatMyron authored Jan 21, 2021
1 parent 197b3b1 commit 13dc44a
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 13dc44a

Please sign in to comment.