Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Mermade/openapi-extract
Extract single paths/operations from OpenAPI definitions
https://github.com/Mermade/openapi-extract
extract extractor metadata microservice microservices openapi openapi3 swagger
Last synced: 3 months ago
JSON representation
Extract single paths/operations from OpenAPI definitions
- Host: GitHub
- URL: https://github.com/Mermade/openapi-extract
- Owner: Mermade
- License: bsd-3-clause
- Created: 2018-01-22T17:56:20.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-03-31T03:28:07.000Z (7 months ago)
- Last Synced: 2024-04-14T09:58:22.040Z (7 months ago)
- Topics: extract, extractor, metadata, microservice, microservices, openapi, openapi3, swagger
- Language: JavaScript
- Homepage:
- Size: 146 KB
- Stars: 24
- Watchers: 4
- Forks: 7
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - Mermade/openapi-extract - Extract single paths/operations from OpenAPI definitions (JavaScript)
README
# openapi-extract
![ci](https://github.com/Mermade/openapi-extract/workflows/ci/badge.svg)
Extract paths, operations, parameters, schemas etc from OpenAPI/Swagger definitions.
Works with OpenAPI/Swagger 2.0 and 3.x definitions.
```
Usage: openapi-extract [options] {infile} [{outfile}]Options:
-h, --help Show help [boolean]
--version Show version number [boolean]
--openai make the definition OpenAI compliant [boolean]
--server include server information [boolean]
--shard shard the input to an output directory [string]
-p, --path the path to extract [string]
-o, --operationid the operationIds to extract [array]
-m, --method the method to extract for the given path [string]
-i, --info copy full info object, otherwise minimal [boolean]
-d, --removeDocs remove all externalDocs properties [boolean]
-r, --removeExamples remove all example/examples properties [boolean]
-x, --removeExtensions remove all x- extension properties [boolean]
-s, --security include security information [boolean]
-v, --verbose increase verbosity [boolean]
```or
```javascript
const openapiExtractor = require('openapi-extract');
const options = {};
// options.path = '...';
// options.method = '...';
// options.operationid = ['...'];
const res = openapiExtractor.extract(obj, options);const map = openapiExtractor.shard(obj, options);
```The `options` object takes the same values as the CLI, for these keys and default values:
* path = ''
* method = ''
* info = false
* openai = false
* removeDocs = false
* removeExamples = false
* removeExtensions = false
* server = false
* security = false
* operationid = []## OpenAI compliant mode
This option turns on the following rules:
1. The `description` properties must have a maximum length of 300 characters