Skip to content

Conversation

@P0lip
Copy link
Contributor

@P0lip P0lip commented Jan 29, 2020

@P0lip P0lip added the enhancement New feature or request label Jan 29, 2020
@P0lip P0lip requested review from a team and lottamus January 29, 2020 14:06
@P0lip P0lip self-assigned this Jan 29, 2020
Copy link
Contributor

@lottamus lottamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! One suggestion to make the "deprecated" text orange. And another to safe stringify the object validation

} else if (typeof validation === 'object') {
elem = (
<div className="m-1 px-1 bg-gray-2 dark:bg-gray-8 font-bold text-sm rounded" key={index}>
{'{...}'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we stringify the validation here too so we can display the properties? Similar to what were doing on L53

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reason we did it in the first place is that the object might be large and therefore the text produced wouldn't be readable.

} else {
elem = (
<div className="m-1 px-1 bg-gray-2 dark:bg-gray-8 font-bold text-sm rounded" key={index}>
{JSON.stringify(validation)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we safe stringify here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know. I'd say no, since you won't be able to recognize strings and numbers, i.e. "1" and 1.

Example:

  • JSON.stringify

    • string 2
      image
    • number 2
      image
  • safe stringify

    • string 2
      image
    • number 2
      image

Co-Authored-By: Chris Lott <chrisnlott@gmail.com>
@P0lip P0lip merged commit d230bb9 into master Feb 14, 2020
@P0lip P0lip deleted the feat/x-deprecated branch February 14, 2020 11:15
@stoplight-bot
Copy link
Collaborator

🎉 This PR is included in version 2.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants