841 Validate properties are defined on cfn validate #892
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
841
Description of changes:
This PR is not ready for production - it makes several of the current test cases fail. I wanted to start a conversation about whether all of this validation is needed before I considered modifying current test cases. The main reason I made this PR was to introduce myself to the codebase. I realize this PR may or may not be helpful to your team. If you find that this PR is heading in the right direction, please provide feedback. If you're not interested in adding this functionality, no problem, it was fun diving in.
This PR implements validation for the top level of properties in the resource schema. For the following resource schema keys, a validation function ensures that properties at the top level of the "property" object are defined.
"readOnlyProperties", "createOnlyProperties", "primaryIdentifier", "required", "additionalIdentifiers", "deprecatedProperties", "writeOnlyProperties",
The following assumptions are made in these changes, please confirm:
These changes handle examples like this:
"createOnlyProperties": [ "/properties/Name" ]
but not nested properties like this, see below section about traversing the json structure:
"createOnlyProperties": [ "/properties/obj1/obj2/str1" ]
As mentioned above, this PR omits nested properties. I started diving into nested properties but I decided I would need discuss the requirements before doing any more work. There were several complexities which I had questions about including the array data type and circular references. If you think it would be helpful to show you what I have so far for this on another branch, let me know and I'll share.
I've included several new test cases which run successfully only in isolation at this time.
pytest --cov="rpdk.core" --doctest-modules --random-order-bucket="parent" "tests/test_data_loaders.py" -k test_load_resource_spec_property_not_defined --pyargs "rpdk.core" --verbose
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.