forked fromBrianWendt/json-schema-md-doc
- Notifications
You must be signed in to change notification settings - Fork0
Generate markdown documentation for JSON Schemas
License
NotificationsYou must be signed in to change notification settings
finn-no/json-schema-md-doc
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
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.
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}}};
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
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Languages
- JavaScript100.0%