Skip to content

Falsy default values are not displayed #168

Open
@P0lip

Description

@P0lip

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions