From 5c4830d7ea6fde002af90b2c14a183645da2c294 Mon Sep 17 00:00:00 2001 From: Pat Myron Date: Mon, 21 Jun 2021 20:12:03 -0700 Subject: [PATCH 1/2] catch common resource schema issues in cfn validate encouraging explicit boolean values instead of defaults --- src/rpdk/core/data_loaders.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/rpdk/core/data_loaders.py b/src/rpdk/core/data_loaders.py index f0a58416..3b37a69c 100644 --- a/src/rpdk/core/data_loaders.py +++ b/src/rpdk/core/data_loaders.py @@ -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"}, @@ -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( From 9dad5d50900e170c5829fa4cad3aba469d897956 Mon Sep 17 00:00:00 2001 From: Pat Myron Date: Tue, 22 Jun 2021 14:29:08 -0700 Subject: [PATCH 2/2] adding explicit taggable value to test resource schema --- tests/data/schema/valid/valid_array_no_items.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/data/schema/valid/valid_array_no_items.json b/tests/data/schema/valid/valid_array_no_items.json index 6252e093..b438d3a7 100644 --- a/tests/data/schema/valid/valid_array_no_items.json +++ b/tests/data/schema/valid/valid_array_no_items.json @@ -12,5 +12,6 @@ "readOnlyProperties": [ "/properties/property1" ], - "additionalProperties": false + "additionalProperties": false, + "taggable": false }