Fix lost skip configurations in allof blocks and readOnly and writeOnly in examples #141
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/Why/How?
The sampler ignores readOnly and writeOnly on properties in allOf's and in examples.
The problem with allOf's is that the readOnly and writeOnly information of properties is lost in them. This PR preserves the information by marking the properties with a special object
MARKED_FOR_REMOVAL
which were supposed to be removed byskipNonRequired=true
,skipReadOnly=true
orskipWriteOnly=true
. Before the result is returned all values which are supposed to be removed are removed.The problem with having example values in the sample even if they are readOnly or writeOnly is fixed by traversing the schema again for which the example is intended and removing all values which are invalid from the example.
Reference
Fixes #140
Fixes Redocly/redoc#1238
Testing
Tests for the changes were added.
Screenshots (optional)
Check yourself
Security