Skip to content

Annotations should not be considered as validations #169

Open
@P0lip

Description

@P0lip

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

  1. Given a schema containing some annotation with booleanish value
{
  "type": "boolean",
  "examples": [true]
}
  1. 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
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