1.0.1 • Published 7 years ago

dgeni-jsonschema v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

dgeni-jsonschema

A Dgeni package for generating JSON Schema from JSDoc documentation in source code.

What does this do?

It uses the JSDoc markup to structure a JSON Schema and then renders it to the file. So, this anippet ...

/**
 * @name multyParameterComponent
 *
 * @description
 * Here goes this component description
 *
 * @param {string} title - title description
 * @param {int} counter - counter description
 * @param {string} [default-optional=defaultValue] - default-optional description
 * @param {array} list - list description
 * @param {array} [only-optional] - only-optional description
 *
 **/
const componentConfig = {
  bindings: {
    title: '@',
    counter: '@',
    defaultOptional: '@?',
    list: '<',
    onlyOptional: '<?'
  },
  controller: [ComponentController],
  templateUrl: templateUrl
};

... will be rendered as ...

{
  "type": "object",
  "title": "multyParameterComponent",
  "description": "Here goes this component description",
  "properties": {
    "title": {
      "type": "string",
      "description": "title description"
    },
    "counter": {
      "type": "int",
      "description": "counter description"
    },
    "default-optional": {
      "type": "string",
      "description": "default-optional description",
      "default": "defaultValue"
    },
    "list": {
      "type": "array",
      "description": "list description"
    },
    "only-optional": {
      "type": "array",
      "description": "only-optional description"
    }
  },
  "required": [
    "counter",
    "list",
    "title"
  ]
}

Dgeni configurations

Todos

  • Generate live example;
  • Provide more configurations samples.
1.0.1

7 years ago

1.0.0

7 years ago