https://github.com/blueoakjs/openapi-reference-compiler
Compile Swagger spec file referencing local files into a single spec
https://github.com/blueoakjs/openapi-reference-compiler
Last synced: 3 months ago
JSON representation
Compile Swagger spec file referencing local files into a single spec
- Host: GitHub
- URL: https://github.com/blueoakjs/openapi-reference-compiler
- Owner: BlueOakJS
- License: mit
- Created: 2017-12-20T18:58:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-20T12:02:28.000Z (about 8 years ago)
- Last Synced: 2025-09-27T23:38:53.447Z (8 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 3
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openapi-reference-compiler
> Compile an OpenAPI specification referencing local files into a single specification file
## Installation
```bash
npm i openapi-reference-compiler
```
## Features
- Compiles a main OpenAPI specification file that references other local files into a single OpenAPI JSON file
- Allows reference directories to be specified
## Usage
It is suggested to use this utility invoked by an NPM script so that the OpenAPI documentation can be compiled into a single specification file at build time.
```bash
Usage: refc [options]
Merge OpenAPI definitions into a single file resolving references
Options:
-V, --version output the version number
-i, --inputFile main OpenAPI file
-o, --outputFile where output should be written
-r, --refDirs list of reference directories separated by ':'
-t, --test just testing
-h, --help output usage information
```
### Example command line invocation:
```bash
./node_modules/.bin/refc
-i ./swagger-source/api.yaml
-o ./swagger/api.json
-r ./node_modules/common-errors/swagger
```
### Example invocation via NPM:
#### In package.json, include:
```JSON
"scripts": {
"swagger": "refc -i ./swagger-source/api.yaml -o ./swagger/api.json -r ./node_modules/common-errors/swagger"
}
```
#### Then invoke using:
```bash
npm run swagger
```
## Changelog
- 1.0.0: Initial release
## License
Copyright (c) 2017 PointSource, LLC.
MIT Licensed