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

Annotations should not be considered as validations #169

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

Annotations should not be considered as validations #169

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

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

@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