Fixing indentation in the generated configuration (#1663) #1668
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.
Why make this change?
In the following picture, the entity name
Todo
is indented with 4 leading spaces, subsequently its child keysource
should have been indented with 6 leading spaces, however its currently indented with only 2 spaces.What is this change?
How does this change fix the issue?
WriteRawValue
writes the json string argument provided as is without doing any additional formatting on it. It doesn't utilize the_currentDepth
private member of the writer to determine how to indent.Prior to this change, we were generating the inner json string first then writing the generated inner json "as is". While generating that json on line 29
data-api-builder/src/Config/Converters/RuntimeEntitiesConverter.cs
Line 29 in 31b7542
Line 29 in
31b7542
a new writer is being used by the
JsonSerializer.Serialize()
function, effectively resetting the_currentDepth
. The_currentDepth
of the writer in context was not getting honored.How was this tested?
dab add
to simulate automatic writing of an entity to the config file. With the change, the indentation is fixed.