json-schema-viewer
json-schema-viewer copied to clipboard
Annotations should not be considered as validations
Describe the bug
Since we mix validations & annotations, they undergo pretty much the same process.
While avoiding true
or false
makes perfect sense in the case of validation keywords, it ruins the experience in the case of annotations.
To Reproduce
- Given a schema containing some annotation with booleanish value
{
"type": "boolean",
"examples": [true]
}
- The values are not displayed
Expected behavior
The values are displayed
Additional context
This is caused by https://github.com/stoplightio/json-schema-viewer/blob/master/src/components/shared/Validations.tsx#L112
We should filter out annotations The correct code could look so
pickBy(validations, (v, k) => !['examples', 'default'].includes(k) && ['true', 'false'].includes(String(v))),
Screenshots
Add medium label/.