Comments (1)
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 ?
- According to ajv, Draft-07 is the most widely used version and by consequence, draft-04 is deprecated & many packages don't even care about it anymore like the library I use for the Typescript types
- Viewer main targets are Draft-07 / Draft 2019-09 / Draft 2020-12, as expressed in the readme
- There are some backwards-incompatible changes between draft-04 & other versions, such as on
exclusiveMaximum
/exclusiveMinimum
definitions - Discussion about that specs on MongoDB forums : https://www.mongodb.com/community/forums/t/validation-using-latest-json-schema-version/2082
- ...
Long answer :
Open closed principle should be applied here.
MongoDB extended Draft 4 of JSON specs with 3 major differences :
$jsonSchema
is their root elementexclusiveMaximum
/exclusiveMinimum
breaking changes definitions- Their
bsonType
(similar totype
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)
- [feature request] Add id to html elements so that we can link to them in the url
- Enhance landing page Responsiveness HOT 13
- detectedTypes returns new Set instead of new Array HOT 1
- static file not being served in build HOT 3
- Hacktoberfest contribution ideas
- JSONSchemaViewer colors palette override HOT 1
- Show description before the type HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â¤ď¸ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docusaurus-json-schema-plugin.