Extended tools for openapi spec
Project description
openapi-ext-tools
extended tools for openapi spec
bundle multiple yaml files into single openapi.yaml
$ openapi-spec-cli --help
usage: openapi-spec-cli [-h] --spec-path SPEC_PATH
[--bundled-spec-path BUNDLED_SPEC_PATH] [--verbose]
optional arguments:
-h, --help show this help message and exit
--spec-path SPEC_PATH
set path to openapi spec file
--bundled-spec-path BUNDLED_SPEC_PATH
set path to bundled spec file
--verbose set verbose mode
How to use
Currently, bundling only support components object.
The tests/fixtures/simple/openapi.yaml
is openapi specification file and a part of schemas is defined in tests/fixtures/simple/schemas.yaml
.
...
content:
application/json:
schema:
$ref: 'schemas.yaml#/components/schemas/User'
...
For example, User schema is defined like this.
components:
schemas:
User:
type: object
properties:
id:
type: integer
format: int64
username:
type: string
firstName:
type: string
lastName:
type: string
birthday:
type: string
format: date
email:
type: string
password:
type: string
phone:
type: string
userStatus:
type: integer
description: User Status
format: int32
Run openapi-spec-cli
to bundle yaml files and create single openapi.yaml
.
$ openapi-spec-cli --spec-path tests/fixtures/simple/openapi.yaml
2019-05-11 11:56:12,337 openapi.spec.ext INFO wrote bundled spec file to "bundled_openapi.yaml"
2019-05-11 11:56:12,402 openapi.spec.ext INFO validating bundled spec: OK
You can confirm bundled_openapi.yaml
in current directory. Then, all schemas in schemas.yaml
are moved to bundled_openapi.yaml
and a $ref
field also reffers as Local Reference.
...
content:
application/json:
schema:
$ref: '#/components/schemas/User'
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file openapi-ext-tools-0.5.0.tar.gz
.
File metadata
- Download URL: openapi-ext-tools-0.5.0.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77146f977abd15b015aaa294816289cd568013762207f42ee783fc91c00f2ff9 |
|
MD5 | 40103aba6d626d2a908d488620c48080 |
|
BLAKE2b-256 | 5d73b971a9a892b793da73d51c540e62029c0c58a22660ac0690dc56c466a21e |
File details
Details for the file openapi_ext_tools-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: openapi_ext_tools-0.5.0-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 020ad015934da881df5890ecd072733afcab5c8cde2921add2bd43e45483c17d |
|
MD5 | b990b315af11329eec79134e4622e638 |
|
BLAKE2b-256 | e13d358703dc345221f720e4ea836ce28d14fd2d0334361376723de73fbc9036 |