fix: YAML, Add deserialization Handler for DeletedKeyWithId#3203
Open
Eideren wants to merge 1 commit into
Open
fix: YAML, Add deserialization Handler for DeletedKeyWithId#3203Eideren wants to merge 1 commit into
Eideren wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Details
Some definition to ensure the rest makes sense, here's how an entry for an item in a collection looks like in YAML:
4f2a44a83ccd0b9a1d6f8d3f5f0772d2~0is aKeyWithId,4f2a44a83ccd0b9a1d6f8d3f5f0772d2would be the Id, while0is the key.Deserializing a collections whose items defined on the base prefab have been removed would lead to a warning when loading in a project;
It's fairly easy to repro;
This is how the two yaml look like after this operation:
Base:
Derived:
We might naively think that the deleted entry on the derived one doesn't make a ton of sense, but remember that we started by changing the derived one before changing the base one. Given that specificity, index 0 on the derived one should not inherit any changes from index #0 on its base. That would break user expectations as something overriden on derived should never be affected by changes on the base.
What's going on:
KeyWithIdSerializer.ConvertFrom()callsPrimitiveSerializer.ConvertFrom()which in turn throws as the keyString provided is empty herestride/sources/assets/Stride.Core.Assets/Yaml/KeyWithIdSerializer.cs
Lines 40 to 43 in 137215c
The ConvertTo method of this same class does not output a key when the value is a removal;
stride/sources/assets/Stride.Core.Assets/Yaml/KeyWithIdSerializer.cs
Lines 66 to 71 in 137215c
Looks like that particular implementation wasn't entirely finished, so I added in logic in
ConvertFromto mirrorConvertTo's behavior.Related Issue
Types of changes
Checklist