YANG model-driven swagger/openapi transform
npm install yang-swaggerYANG model-driven swagger/openapi transform
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
``bash`
$ npm install -g yang-swagger
The preferred installation is global for easy access to the
yang-swagger utility but can also be used as a dependency module to
help generate swagger/openapi specification as part of your project.
> NOTE: Currently, Swagger/OpenAPI 2.0 Specification does NOT
> support JSON-schema anyOf and oneOf directives, which meanschoice/case
> that we cannot properly treat YANG statements duringchoice/case
> conversion. As a work-around, the current transform will simply
> serialize all configuration nodes from the sections
> into a flat list of properties.
`bash`
$ yang-swagger -f yaml -o swagger.yaml yang-openapi
The above example will import the yang-openapi YANG module and
transform into swagger specification YAML file.
`
Usage: yang-swagger [options] modules...
Options:
-c, --config
-f, --format
-o, --output
`
Using the --config option will allow you to specify where to findyang-openapi
the configuration data for the YANG module. By default,config
it will check the directory but you can specify any arbitraryyang-openapi:info
file location for specifying the configuration
data.
You can also use it as a library module:
`coffeescript``
swag = require("yang-swagger").eval {
'yang-openapi:info':
title: "my-api"
description: "describe purpose"
version: "1.0"
contact:
name: "your name"
url: "http://some/website"
email: "your email"
license:
name: "Apache-2.0"
}
swag.in('transform')
.invoke modules: [ 'yang-openapi' ]
.then (output) ->
console.log "do something with
For more information on programmatic usage, be sure to take a look at
the References listed below.
- Apiary Documentation
- Working with Multiple Schemas
- Expressing Interfaces
- Using YANG with JavaScript
This software is brought to you by
Corenova Technologies. We'd love to hear
your feedback. Please feel free to reach me at
anytime with questions, suggestions, etc.
[npm-image]: https://img.shields.io/npm/v/yang-swagger.svg
[npm-url]: https://npmjs.org/package/yang-swagger
[downloads-image]: https://img.shields.io/npm/dt/yang-swagger.svg
[downloads-url]: https://npmjs.org/package/yang-swagger