GithubHelp home page GithubHelp logo

jy95 / docusaurus-json-schema-plugin Goto Github PK

View Code? Open in Web Editor NEW
54.0 54.0 9.0 26.84 MB

JSON Schema viewer / editor in Docusaurus

Home Page: https://jy95.github.io/docusaurus-json-schema-plugin/

License: GNU Affero General Public License v3.0

TypeScript 71.43% JavaScript 4.77% CSS 0.88% MDX 22.92%
docusaurus docusaurus-plugin docusaurus-theme hacktoberfest hacktoberfest-accepted json-schema json-schema-documentation json-schema-editor json-schema-viewer

docusaurus-json-schema-plugin's People

Contributors

actions-user avatar dependabot[bot] avatar gnidan avatar jy95 avatar mathanraj0601 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

docusaurus-json-schema-plugin's Issues

Enhance landing page Responsiveness

Enhance responsiveness

I found that the text and description in the card of the landing page are text-aligned left for

  • JSON Schema Viewer / Editor
  • Configurable
  • Open source
    I think It does not suit the responsiveness of the website
    I went through the code and made it text-align center below I will attach the screenshot comparing both:

Screen Width above 1200 px

From:

as1

To;

ss1

Screen Width below 1200 px

From:

as2

To:

ss2

Screen Width below 500px:

###From:

as3
###To:

ss3

Tab crash with empty examples array

Describe the bug
A schema with an empty "examples" array at the top level leads to a page crash with the error

Docusaurus error: the <Tabs> component requires at least one <TabItem> children component

To Reproduce

The following page will demonstrate the crash

<JSONSchemaViewer 
    schema={ {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "examples": []
    } } 
    viewerOptions={ 
        {
        "showExamples": true, 
        }
    }
/>

Demonstrated with Docusaurus 3.4.0, docusaurus-json-schema-plugin 1.12.1

Expected behavior

Behave as if the examples array was not present

Screenshots

Desktop (please complete the following information):

  • OS: Served in Linux; viewed in Linux & Windows
  • Browser [e.g. chrome, safari]: Firefox
  • Version [e.g. 22] FIrefox 128

Show description before the type

Hi,

I was wondering whether it's possible to show the description above the type, which is particularly useful for objects with a lot of fields.

Example JSON should be pretty printed / formatterd

Is your feature request related to a problem? Please describe.
When showing examples within the schema, they are currently output as a single line of JSON, which may be rather long.

Describe the solution you'd like
It would seem helpful to pretty-print the examples somehow. Color would be nice to have, but just adding newlines / indentation would be an easy win.

Additional context

I'm getting my head around the codebase - I think the change needs to go here?

Is it as simple as adding JSON.stringify(item.value, null, 4) to the <CreateValue> on line 53?

static file not being served in build

I created a page to display all my json-schema (i,e /schema), I used schema.mdx file to display it

image

In each of the mdx file, it looks something like this but importing different json file

import JSONSchemaViewer from "@theme/JSONSchemaViewer"
import schema from "@site/static/schema/geo.json"

<JSONSchemaViewer schema={schema} />

In local development, it works as expected.

image

But when I build and serve it, it doesn't load the content

image

Not sure if it matters but I'm using javascript setup of docusaurus instead of typescript.

Let me know if more information is required, or if this is a docusaurus issue, then I can redirect over to their repo.

Thanks!

JSONSchemaViewer colors palette override

Hi there! thanks for this wonderful plugin :)

Any hint on how to customize the colors used by the JSONSchemaViewer React component and override the ones given by docusaurus?

thanks!

Support MongoDB $jsonSchema

Is it possible to support it?

See mongodb-jsonschema

A sample

{ $jsonSchema: <JSON Schema object> }
{
  $jsonSchema: {
     required: [ "name", "major", "gpa", "address" ],
     properties: {
        name: {
           bsonType: "string",
           description: "must be a string and is required"
        },
        address: {
           bsonType: "object",
           required: [ "zipcode" ],
           properties: {
               "street": { bsonType: "string" },
               "zipcode": { bsonType: "string" }
           }
        }
     }
  }
}

If it does, I imagine I would use the same way I did before to display it

import JSONSchemaViewer from "@theme/JSONSchemaViewer"
import schema from "@site/static/schema/mongo.json"

<JSONSchemaViewer schema={schema} />

Thanks

detectedTypes returns new Set instead of new Array

I hesitate to report this as an issue since it was found while using swizzled source code against the latest Docusaurus beta, so maybe it's not a concern, but I found that the downstream parsing of the return value from this line doesn't work because it is a Set[] instead of an string[] (or whatever is in the original array).

if (declaredTypes.length !== 0) {
return [...new Set(declaredTypes)]
}

I believe the TypeScript issue is reported, but I've had no luck with configuring TypeScript compile this to be an array, and had to patch with:

- return [...new Set(declaredTypes)];
+ return Array.from(new Set(declaredTypes));

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.