Generates and inject apidoc example elements from api schemas or files.
@apiExample {SCHEMA_TYPE=PATH_TO_SCHEMA} ELEMENT_TYPE TITLE
npm install apidoc-plugin-example --save-dev
Prettifies JSON and injects in.
Uses json-schema-faker to generate a sample response.
/**
* @api {get} /api GetAPI
* @apiExample {json=./ex/api.req.json} apiParamExample Request
* @apiExample {jsonschema=./ex/api.res.json} apiSuccessExample Response JSON
* @apiExample {xml=./ex/api.res.xml} apiSuccessExample Response XML
*/
apidoc.json
{
sampleJsonSchemaPath: "./schema/";
}
comment:
/**
* @api {get} /api GetAPI
* @apiExample {json=api.req.json} apiParamExample Request
* @apiExample {jsonschema=api.res.json} apiSuccessExample Response JSON
* @apiExample {xml=api.res.xml} apiSuccessExample Response XML
*/
This plugin uses parser-find-elements
@ priority 201
.
- Add in wsdl schema / XSD