Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Generate markdown documentation for JSON Schemas

License

NotificationsYou must be signed in to change notification settings

finn-no/json-schema-md-doc

 
 

Repository files navigation

Generate markdown documentation for JSON Schemas

Try it out atbrianwendt.github.io/json-schema-md-doc

DownloadJSONSchemaMarkdown.js

Click here to see the Node example.

NOTE: JSONSchemaMarkdown.js supportsjson-schema.orgdraft-7. Previous drafts may not generate documentation correctly.

Simple Implementation

NPM Project

npm install json-schema-md-doc
import{JSONSchemaMarkdown}from"json-schema-md-doc";

orHTML

<scriptsrc="https://brianwendt.github.io/json-schema-md-doc/lib/JSONSchemaMarkdown.js"></script>

Javascript

// simple schema for the exampleconstcolors_schema={"description":"Choose a color","type":"string","enum":["red","amber","green"]}// create an instance of JSONSchemaMarkdownconstDoccer=newJSONSchemaMarkdown();// load the schemaDoccer.load(colors_schema);// generate the markdownconsole.log(Doccer.generate());

Result

_Choose a color_Type:`string`Enum Values:1._"red"_2._"amber"_3._"green"__Generated with[json-schema-md-doc](https://brianwendt.github.io/json-schema-md-doc/)_

For a more complete example,check out this JSFiddle.

Extendable

You may easily extendJSONSchemaMarkdown.js to customize the formatting of your markdown by overriding any method.

classMyDoccerextendsJSONSchemaMarkdown{constructor(){super();this.footer="Thanks for reading the documentation!";}valueBool(bool){if(typeofbool==="string"){returnbool;}else{return(bool) ?"TRUE" :"FALSE";//uppercase instead of true/false}}};

Another example

Paths print likejq paths.Compact hides some of the output.

constDoccer=newJSONSchemaMarkdown();Doccer.indentChar=" ";Doccer.rootChar="";Doccer.pathDivider=".";Doccer.pathForProperties="";Doccer.pathForDefinitions="";Doccer.pathForItems="[*]";Doccer.omitPathDividerForItems=true;Doccer.compact=true;

About

Generate markdown documentation for JSON Schemas

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript100.0%

[8]ページ先頭

©2009-2025 Movatter.jp