ethdebug / format

Smart contract debugging data format – Standards development working group
https://ethdebug.github.io/format/
47 stars 4 forks source link

Cleanup schema explorer override code for polymorphic discriminators #75

Closed gnidan closed 9 months ago

gnidan commented 9 months ago

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.