This repository was archived by the owner on Mar 20, 2022. It is now read-only.
fix(schemas): don't use schema to attribute mapping on singular array schemas #387
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.
Problem
Denormalization does not seem to produce the correct result when a singular Array schema owns an Object schema whose instances own an
id
property.For example:
The problem is in the the
denormalizeValue
method of thePolymorphic
class.When the value to be unvisited owns a property named
id
, then this method uses the value of theid
property as the input value for the call tounvisit
in place of the value itself, which is not the case on singular Array schema, where the value itself should always be used instead.Solution
I've added a guard which prevents the value of the
id
property to become the input tounvisit
when the current schema is a singular schema.TODO