Skip to content

Conversation

@EdVinyard
Copy link
Contributor

@EdVinyard EdVinyard commented Nov 13, 2023

Motivation and Context

https://github.com/stoplightio/platform-internal/issues/18370

json-schema-viewer and TryIt have been using different logic to determine if/how to display form-encoded schemas that have a oneOf combiner at the top level.

Description

Expose a few utility features for use by related, downstream tools that also render JSON Schema in one way or another.
Specifically, the TryIt function of Elements will be able to reuse the same logic -- and thereby get the same visible results -- as json-schema-viewer.

How Has This Been Tested?

Existing functionality is being exported; no functional changes were made.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

@EdVinyard EdVinyard marked this pull request as ready for review November 13, 2023 17:01
@EdVinyard EdVinyard requested review from a team and chohmann and removed request for a team November 13, 2023 17:03
Copy link

@chohmann chohmann left a comment

Choose a reason for hiding this comment

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

LGTM except for a probably rogue console.log statement.

Comment on lines 23 to 24
// eslint-disable-next-line no-console
console.log({ childNodes });

Choose a reason for hiding this comment

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

remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for catching that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed in 2bf4e4a

Copy link

@mallachari mallachari 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 and naming should be fine

const childNodes = React.useMemo(() => calculateChildrenToShow(selectedChoice.type), [selectedChoice.type]);
const childNodes = React.useMemo(() => visibleChildren(selectedChoice.type), [selectedChoice.type]);
// eslint-disable-next-line no-console
console.log({ childNodes });

Choose a reason for hiding this comment

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

Suggested change
console.log({ childNodes });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you both for catching that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed in 2bf4e4a

@EdVinyard EdVinyard merged commit a4c440d into master Nov 13, 2023
@EdVinyard EdVinyard deleted the feat/18370-try-it-form-urlencoded-combiners branch November 13, 2023 17:24
@stoplight-bot
Copy link
Collaborator

🎉 This PR is included in version 4.13.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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants