swagger-bundler
This is individual tool for bundling swagger definitions.
python3 only (python3.5+ is better)
setup
$ pip install "swagger-bundler[validation]"
or
$ pip install -e git+git@github.com:podhmo/swagger-bundler.git@master#egg=swagger_bundler
getting started
generating your config file
using it
0. generating your config file
swagger-bundler needs config file for using. so, at first, you must generate config file.
$ swagger-bundler config --init generate ~/venv/web/work/swagger-bundler.ini.
The stragegy of finding config file, following below.
Your current working directory is ~/venv/web/work/. then,
finds ~/venv/web/work/swagger-bundler.ini
finds ~/venv/web/swagger-bundler.ini
finds ~/venv/swagger-bundler.ini
finds ~/swagger-bundler.ini
Config file is not found, then, lookup ~/.swagger-bundle.ini.
1. how to use
Usage: swagger-bundler [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
bundle bundles many source files into single file
concat concatnates many swagger-definition files
config show config
validate validates via swagger-2.0 spec
Swagger-bundler has two commands.
bundle
concat
bundle
This is the main feature. bundling many source files into one single swagger-definition file.
$ swagger-bundler bundle <file.yaml>
The target file of swagger-bundler, it can use three special-marker.
x-bundler-namespace – when bundling, using this value as prefix string.
x-bundler-compose – importing from other files with namespace
x-bundler-concat – importing from other files without namespace
For example. the structure of current working directory is such as below,
.
├── main.yaml
└── parts
├── common.yaml
├── x.yaml
└── y.yaml
and the content of main.yaml is this.
x-bundler-namespace: ZZZ
x-bundler-compose:
- ./parts/x.yaml
- ./parts/y.yaml
x-bundler-concat:
- ./parts/common.yaml
And run it.
$ swagger-bundler bundle main.yaml
definitions in x.yaml, y.yaml are renamed (with namespace). (e.g. foo -> ZZZFoo)
definitions in common.yaml are not renamed. (e.g. bar -> bar)
The link of example.
qualified import.
x-bundler-namespace: O
x-bundler-compose:
- ../parts/x-state.yaml as X
- ../parts/y-state.yaml as Y
then
state of x-state.yaml is converting XState, eventually, OXState
state of y-state.yaml is converting YState, eventually, OYState
the link of example(qualified import)
concat
This is just concatnate files.
$ swagger-bundler concat [file1.yaml] [file2.yaml] ...
appendix:
hook configuration.
watch option is supported.
hook configuration
Hook configuration examples.
watch option
# installed with [watch] $ pip install "swagger-bundler[watch]" $ swagger-bundler bundle --watch "*.yaml" --outfile="/tmp/output.yaml" src.yaml
0.1.10.4
fix deref implemetation
0.1.10.1
fix deref implemetation
0.1.10
adding load hook
(adding deref example)
0.1.9
fix titlize function is invalid that using lifting definition hook. (fooBar -> Foobar)
0.1.8
fix qualified import bug(since 0.1.7)
0.1.7
reviving context cache
fix ValueError when merging with None
0.1.6
fix bug (lifting definition on array)
0.1.5
adding postscript.lifting_definition(hook)
0.1.4
adding extra information, exposed_predicate, on prefixing(add_namespace) postscript hook
0.1.3
bug fix
0.1.2
adding orphan reference check
0.1.1
more hooks (add_namespace, validate)
0.1
postscript_hook
0.0.7
prefixing targets responses,definisions -> responses,definisions,parameters
0.0.6
fix case: ctx.data has ‘responses’ data (but value is None)
fix watching generated file
0.0.5
watch option is supported
0.0.4
gentle warning message on FileNotFoundError
bundle command with –namespace option
qualified import (e.g. x-bundler-compose with ‘foo.yaml as F’)
0.0.3
adding readme and examples
support json format(input/output)
Metadata
Release files for swagger-bundler 0.1.10.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swagger-bundler-0.1.10.6.tar.gz | 20.4 kB | Without provenance | Details for swagger-bundler-0.1.10.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swagger_bundler-0.1.10.6-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for swagger_bundler-0.1.10.6-py2.py3-none-any.whl |
Total release size: 46.3 kB
Release files / swagger-bundler-0.1.10.6.tar.gz
| Download URL | swagger-bundler-0.1.10.6.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00a142f48b5ed523ff7149e69d3717d39c3170df96752901491a72cf77d461d4
|
|
BLAKE2b-256 checksum How to use checksums |
d3a21d272266cdaf577d68af063a0dacabafc6ab3b2ce73653d7caca694851fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / swagger_bundler-0.1.10.6-py2.py3-none-any.whl
| Download URL | swagger_bundler-0.1.10.6-py2.py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1b416dc4774e6b9564814a1e70671b46502dcc9034078bfbe4f0f3378cee6508
|
|
BLAKE2b-256 checksum How to use checksums |
e2c7e3d37c3f1c90ba200bf5d4259eb70b514a2ab6e9eddabfe5fea666326517
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for swagger-bundler 0.1.10.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.