Documenting and validating complex JSON Schemas can be hard. This tool maks it easier by providing a number of scripts that can turn JSON Schema files into readable Markdown documenation that is ready for consumption on GitHub or processed using Jekyll or other static site generators.
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.
# -d, --input path to directory containing all JSON Schemas or a single JSON Schema file. This will be considered as the baseURL [required]
# -f, --isFile pass if input is a single file path
# -o, --out path to output directory (default: ./out)
# -m, --meta add metadata elements to .md files Eg -m template=reference. Multiple values can be added by repeating the flag Eg: -m template=reference -m hide-nav=true
# -x, --schema-out output JSON Schema files including description and validated examples in the _new folder at output directory
# -s, --metaSchema path to Custom meta schema to validate other schemas
$ node cli.js
# run task
$ node index.js -d ../xdm/schemas/draft-04/
$ node cli.js -d ../xdm/schemas/external/
# generated output for whole folder is written to ./out
```
...
...
@@ -49,7 +37,7 @@ The JSON Schema Markdown tools also includes a convenient `jsonschema2md` comman
$ npm link
```
The command line arguments are identical between the `jsonschema2md` binary and the `index.js` node script
The command line arguments are identical between the `jsonschema2md` binary and the `cli.js` node script.
## Using JSON Schema Markdown Tools from `npm`
...
...
@@ -71,12 +59,19 @@ Then add the following to the `"scripts"` section of your `package.json` and ada
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:
```bash
npm test
```
## TODOs
* JSON Schema validation:
* property naming convention
* vocabulary spellchecking
* Tests
## Contributing
...
...
@@ -87,4 +82,4 @@ Please see [Contributing.md](Contributing.md) for details. Pull requests are wel
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
\ No newline at end of file
of the License at http://www.apache.org/licenses/LICENSE-2.0