Fix the indentation of default values during ADL serialization #653
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.
Follow-up of #651
When serializing Archetypes, indentation was applied incorrectly to default values. Spaces were added to multiline ODIN strings to each line after the first and serialization of unparsed JSON got extra unnecessary indentation applied.
For the indentation to work correctly the process is split into three cases:
DefaultValueContainer
s (e.g. when no metamodels or mappers are available or the format is unknown): These will be serialized as-is in theDefaultValueContainer
. For ODIN this will be unformatted, as any formatting is lost during parsing. For JSON and other formats the serialization will be the same as in the original ADL, keeping any original indentation without adding any extra.This will make the roundtrip serialization of unparsed values and parsed values as ODIN idempotent, as the seriazization of parsed values as JSON already was.