Fix JSON literal value version 1 check. #346
Merged
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.
So this fixes a bug where the JSON literal version 1 check was being performed on the unexpanded input instead of on the expanded output. IOW, it was looking for
@value
on the unexpanded input and then doing some version 1 check on it if@type
was not@json
. If the input uses an alias for@type
(liketype
) this check will be erroneously triggered and throw an error. Example input:The conditional should have been checking for
@type
on the expanded output (expandedParent
) instead -- a similar problem would have occurred if@value
had been aliased.However, in fixing this bug we start to fail some test:
#te029 Verifies that an exception is raised in Expansion when an invalid value object value is found
In looking at the input for that test, however, it seems like the test is wrong. The input is:
Which is not a value object (there is no
@value
... it is a top-level input). So I'm not quite sure what should be done here as I don't know what that test was suppose to test originally.