GithubHelp home page GithubHelp logo

Comments (1)

jy95 avatar jy95 commented on September 6, 2024

Hello @bwgjoseph ,

Short answer :

Low priority for me atm.
A proper way to extend the best effort viewer with extensions of JSON Schema needs some reflexion first.
I would like to avoid rushing things that would leak to issues , breaking changes, ...

Why the low priority ?

Long answer :

Open closed principle should be applied here.
MongoDB extended Draft 4 of JSON specs with 3 major differences :

  1. $jsonSchema is their root element
  2. exclusiveMaximum / exclusiveMinimum breaking changes definitions
  3. Their bsonType (similar to type but with more )

For point n°1

You can use the jsonPointer option inside resolverOptions , such as :

import Schema from "@site/static/schemas/examples/refs/refOnRoot.json";
import JSONSchemaViewer from "@theme/JSONSchemaViewer";

const resolverOptions = {"jsonPointer": "#/definitions/user"}

<JSONSchemaViewer schema={ Schema } resolverOptions={resolverOptions} />

My example in documentation is a good illustration it already works.
If you wonder why this option already exists, well, I had that issue with some of my Draft 7 files I have in one of my other projects 🤐

For point n°2

In my own codebase, bunch of

// @ts-ignore
as boolean | number | undefined

to just cover that version. It seems to be an overhead just to support a single version ...

For point n°3

The hardest as many question aroses :

  • Should I enable users to provide their own components to render their custom types ?
  • Should I provide a default rendering if users don't provide a fallback one ?
  • ...

So I will convert that issue into a discussion to see if other have this need that might help me reconsider my position.
Part of your request (the need for customization) is a track from which I would like other feedbacks: at least, on the internalization side of the labels I am ready ^^

PS : 1.2.0 is out. enhancements should be quite visible : feel free to share your feedback ;)

from docusaurus-json-schema-plugin.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.