tfsdk+types: Fix ObjectType missing attribute error and PathMatches schema validation #602
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.
Closes #600
This change will move the
PathMatches
expression to schema validation to be performed upfront and allow zero matches to be returned. Previously, valid expressions could be rejected errantly in cases of empty collection type values where the expression steps traversed deeper. Consumers ofPathMatches
should not be returned errors in those cases and instead will receive zero path matches, which they can choose whether that result is significant or not. Invalid expressions for the schema will still receive errors.While implementing the new expression to schema validation logic, the
basetypes.ObjectType
implementation was missing an error return for missing attributes which caused false positives. This was actually noticed previously, however a covering issue was not created to fix the behavior, but it is now being fixed as part of correctly implementing the expression to schema validation. Returning an error in this situation is considered the valid implementation detail as object types are statically defined based on the underlying map of attribute names to attribute types. It is never valid to step into a non-existent attribute name.