json-schema-documentation-generator

1.4.1 • Public • Published

JSON-Schema documentation generator

Philosophy

Unlike many documentation generator we want to delegate as much as possible the logic on the theme side. It might be perceived as quite an unusual move but the direct consequence is that you'll never be limited by an intermediate representation of your raw data.

Since the raw data will always be a valid JSON-schema (the generator first validate it), the data structure won't change for a defined json-schema draft version and your interface is thus guaranteed.

❤️ Shameless plug

Install

npm install json-schema-documentation-generator --save

Basic usage

// Code below will generate a
const generator = require('json-schema-documentation-generator');
 
generator({
  input: {
    // (required) json-schemas object list
    schemas: [require('./my-schema.json'), require('./my-second-schema.json')],
 
    // (required) schema sample generator
    samples: {
      generator: require('json-schema-documentation-sample-generator'),
    },
  },
  output: {
    // (required) visual theme
    theme: require('json-schema-documentation-default-theme'),
 
    // (optional) theme option
    options:{
      // (required) override this to specify another generator
      directory: {
        path: path.resolve(__dirname, 'static'),
      },
    },
  },
}).then(
  () => {
    console.log('Documentation generated');
  },
  err => {
    console.error('Could not generate documentation %s', err);
  }
);

See full option documentation parameter object.

Features

  • schema samples
  • theme support

Changelog

Package Sidebar

Install

npm i json-schema-documentation-generator

Weekly Downloads

6

Version

1.4.1

License

MIT

Unpacked Size

35.1 kB

Total Files

21

Last publish

Collaborators

  • fgribreau