Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch common resource schema issues in cfn validate #785

Merged
merged 2 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/rpdk/core/data_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ def load_resource_spec(resource_spec_file): # pylint: disable=R # noqa: C901
try:
property_type = property_details["type"]
property_keywords = property_details.keys()
if (
property_type == "array"
and "insertionOrder" not in property_keywords
):
LOG.warning(
"Explicitly specify value for insertionOrder for array: %s",
property_name,
)
keyword_mappings = [
(
{"integer", "number"},
Expand Down Expand Up @@ -316,6 +324,9 @@ def load_resource_spec(resource_spec_file): # pylint: disable=R # noqa: C901
"readOnlyProperties and conditionalCreateOnlyProperties MUST NOT have common properties"
)

if "taggable" not in resource_spec:
LOG.warning("Explicitly specify value for taggable")

# TODO: more general validation framework
if "remote" in resource_spec:
raise SpecValidationError(
Expand Down
3 changes: 2 additions & 1 deletion tests/data/schema/valid/valid_array_no_items.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
"readOnlyProperties": [
"/properties/property1"
],
"additionalProperties": false
"additionalProperties": false,
"taggable": false
}