-
Notifications
You must be signed in to change notification settings - Fork 163
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 #729
Conversation
"uniqueItems", | ||
"pattern", | ||
"patternProperties", | ||
"multipleOf", | ||
} | ||
try: # pylint: disable=R | ||
for _key, schema in JsonSchemaFlattener(resource_spec).flatten_schema().items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if u are not using _key
could u change it to _
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to clarify - you are using flattened schema to avoid recursive traversal, since all the subschemas are on the same level?
@@ -176,36 +182,45 @@ def load_resource_spec(resource_spec_file): # pylint: disable=R # noqa: C901 | |||
"maximum", | |||
"exclusiveMinimum", | |||
"exclusiveMaximum", | |||
"multipleOf", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cant leave the comment above but could u take this structure out and create a static _dict_
? it is really hard to read this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support this idea too. Also can you create type_specific_keywords
from the _dict_
you create for this structure so that all keywords specified in the _dict_
will be automatically available in type_specific_keywords
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started with dictionary, but integer
and number
types share JSON schema keywords, and lists/sets cannot be used as Python dictionary keys, so I switched
Switched type_specific_keywords
to be automatically generated from the mapping :)
@@ -176,36 +182,45 @@ def load_resource_spec(resource_spec_file): # pylint: disable=R # noqa: C901 | |||
"maximum", | |||
"exclusiveMinimum", | |||
"exclusiveMaximum", | |||
"multipleOf", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I support this idea too. Also can you create type_specific_keywords
from the _dict_
you create for this structure so that all keywords specified in the _dict_
will be automatically available in type_specific_keywords
type_specific_keywords - allowed_keywords | ||
& property_keywords, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this in a variable and use it above and here?
…on#729) expanding type_specific_keywords similar to aws-cloudformation#414
Current running totals for existing AWS resource provider schemas:
|
…on#729) expanding type_specific_keywords similar to aws-cloudformation#414
…on#729) expanding type_specific_keywords similar to aws-cloudformation#414
continuing #663, #668, #675
more incorrect type-specific JSON schema keywords similar to #414
how to run new validations on all existing resource provider schemas:
format
seems intentionally used for other types?, so I guess I'll leave that out of the new validation, even though it looksstring
-specific in JSON schema proper