Cleanup schema explorer override code for polymorphic discriminators #75
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background: I previously added some janky code for detecting this format's conventional use of polymorphic discriminators (using
allOf
withif: { properties: { const: ... } }
, the idea being to render these in a custom manner (different than docusaurus-json-schema-plugin's defaultallOf
rendering).This PR cleans up that code (which currently just lives in a swizzled
AllOfSchema
component), so that it has its own module with adetectDiscriminator()
function and well-typed components, etc.I'm making this change so that it won't get so bad when this project finds other schema conventions that make sense and we want to be able to custom-detect our use of the convention and render it properly.
This PR adds json-schema-typed to the web package and also enables
strict: true
, so this PR contains a few other fixes I noticed along the way.