Fix cluster app JSON schema preprocessing #4613
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.
What does this PR do?
On CAPA installation when you go to cluster creation form you see validation errors that are incorrect.

The reason for this is the error in preprocessing of the default values in JSON schema. In current implementation we convert
"type": "object"
schemas withadditionalProperties
orpatternProperties
into"type": "array"
schemas so they are better supported by the form building library. When converting a subschema we also convert the default value of that subschema if it is present. For example, correct preprocessing:becomes:
In this example
default
value is specified directly in the schema withadditionalProperties
and preprocessed correctly. But in some cases default value for a property can come from default value of parent schema. And such cases are not handled correctly in current implementation, for example:is incorrectly converted into (
childProperty
subschema is converted butdefault
value is not):In this PR schema preprocessing was changed and default values are being correctly converted no matter of where they are defined in the schema.
Any background context you can provide?
Fixes giantswarm/roadmap#3452