json-schema-viewer
json-schema-viewer copied to clipboard
Falsy default values are not displayed
Describe the bug
Falsy default values aren't currently displayed and are entirely ignored.
To Reproduce
- Given any schema model with a falsy default value
{
"type": "number",
"default": 0
}
- It's not rendered
Expected behavior
They are displayed in the same as any other value.
Additional context
Caused by https://github.com/stoplightio/json-schema-viewer/blob/master/src/components/shared/Validations.tsx#L229 This correct code should look more or less as follows
...('default' in schemaNode.annotations ? { default: JSON.stringify(schemaNode.annotations.default) } : null),
Screenshots
add medium label