Background: I previously added some janky code for detecting this format's conventional use of polymorphic discriminators (using allOf with if: { properties: { const: ... } }, the idea being to render these in a custom manner (different than docusaurus-json-schema-plugin's default allOf rendering).
This PR cleans up that code (which currently just lives in a swizzled AllOfSchema component), so that it has its own module with a detectDiscriminator() 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.
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.