Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Falsy default values are not displayed #168

Open
P0lip opened this issue Sep 30, 2021 · 1 comment
Open

Falsy default values are not displayed #168

P0lip opened this issue Sep 30, 2021 · 1 comment
Labels
p/documented t/bug Something isn't working triaged

Comments

@P0lip
Copy link
Contributor

P0lip commented Sep 30, 2021

Describe the bug

Falsy default values aren't currently displayed and are entirely ignored.

To Reproduce

  1. Given any schema model with a falsy default value
{
  "type": "number",
  "default": 0
}
  1. 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

image

image

@P0lip P0lip added the t/bug Something isn't working label Sep 30, 2021
@raleigh04
Copy link

add medium label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p/documented t/bug Something isn't working triaged
Projects
None yet
Development

No branches or pull requests

3 participants