GithubHelp home page GithubHelp logo

markdemich / jsonschema2md Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adobe/jsonschema2md

0.0 1.0 0.0 1.37 MB

Convert Complex JSON Schemas into Markdown Documentation

License: Apache License 2.0

JavaScript 63.38% HTML 36.62%

jsonschema2md's Introduction

JSON Schema Markdown Tools

CircleCI Greenkeeper badge

Documenting and validating complex JSON Schemas can be hard. This tool makes it easier by providing a number of scripts that can turn JSON Schema files into readable Markdown documentation that is ready for consumption on GitHub or processed using Jekyll or other static site generators.

These tools have been introduced by Adobe to document Adobe's Experience Data Models (XDM), but can be used for other JSON Schema documents, too.

Requirements

  • npm version 3.10.8 or up
  • node v6 or up

Example Output

Using the schemas in examples/schemas, the output in examples/docs has been generated.

Installing and running

# clone this project
$ git clone [email protected]:adobe/jsonschema2md.git

# install dependencies
$ cd jsonschema2md && npm install

# show usage information
$ node cli.js

# run task
$ node cli.js -d examples/schemas -o examples/docs
# generated output for whole folder is written to ./examples/docs

JSON Schema Draft Versions

jsonschema2md assumes draft-07 by default. If your schemas are not on draft-07, you can specify the draft version using the -v or --draft flag.

# run against JSON Schema Draft 04
$ node cli.js -d examples/schemas -o examples/docs -v 04
# run against JSON Schema Draft 06
$ node cli.js -d examples/schemas -o examples/docs -v 06

Installing the jsonschema2md Command Line Tools

The JSON Schema Markdown tools also includes a convenient jsonschema2md command line tool that can be installed using:

$ npm link

The command line arguments are identical between the jsonschema2md binary and the cli.js node script.

Using JSON Schema Markdown Tools from npm

You can conveniently use the JSON Schema Markdown Tools from npm. This makes it possible to set up a conversion toolchain for your JSON Schema project that is driven entirely by npm. To do so, first define the dependency by adding this to your "devDependencies" section of package.json

  "devDependencies": {
    "jsonschema2md": "^1.0.6"
  }

Then add the following to the "scripts" section of your package.json and adapt accordingly:

"scripts": {
  "prepare": "mkdir -p docs/reference && jsonschema2md -o docs/reference -d schemas/draft-04
}

If you run npm install before running npm run prepare, npm will install the jsonschema2md in a node_modules/.bin path, even if you did not install the JSON Schema Markdown beforehand.

Tests

Ensure you have all the dependencies installed via npm install, then run:

npm test

This will run our Jasmine test suite as well as lint the JavaScript according to our style guide (see below).

CI

Continuous integration runs on CircleCI. All pull requests automatically trigger a job that runs the tests by executing the config.yml.

Code Coverage

You can run npm run cover to get a code coverage report, that is, a sense of how much of the project's code is "covered" by the test suite.

Style Guide / Linting

This project uses eslint to enforce JavaScript coding style. To run the linter:

npm run lint

TODOs

  • JSON Schema validation:
    • property naming convention
    • vocabulary spellchecking

Contributing

Please see Contributing.md for details. Pull requests are welcome.

License/Copyright

Copyright 2017 Adobe Systems Incorporated. All rights reserved. This file is licensed to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

jsonschema2md's People

Contributors

andyogo avatar angupt avatar anjankaur avatar ankaur avatar asteed avatar deckardrick avatar filmaj avatar greenkeeper[bot] avatar kgera avatar man0s avatar manitanuj avatar mcdan avatar robvenn avatar stefan-guggisberg avatar trieloff avatar

Watchers

 avatar

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.