CLI tool to modularize and maintain OpenAPI docs
Project description
Swaggerizer
A lightweight CLI tool to modularize, maintain, and publish OpenAPI docs.
Swaggerizer takes a practical approach to OpenAPI docs management, in the sweet spot between too monolithic or too granular. It breaks up OpenAPI spec files by functional groups and uses a simple make-based system to reassemble them.
The Swaggerizer project structure makes it easy for a single writer to build and maintain OpenAPI docs, or for a team of writers to collaborate using a docs-as-code approach.
Swaggerizing your OpenAPI docs is risk free. It creates a separate source folder with the modularized project files, so you can test it out before committing to anything. Give it a try!
Features
- Create a modular OpenAPI project from a single OpenAPI YAML file:
- Modularize an existing OpenAPI file, or start a new project from the default Petstore file
- Use make to test and reassemble a single OpenAPI file out of the project/source files
- Project files are set up in the openapi_src sub-directory, with the following structure:
openapi_src/ ├── 0_intro/ # Basic info, metadata, and tags ├── 1_endpoints/ # Endpoint descriptions grouped by tag (one file per tag) ├── 2_components/ # Reusable objects (schemas, parameters, examples, etc.) ├── 3_misc/ # Additional top-level sections not categorized above └── makefile # Custom makefile to generate the final OpenAPI file
- Other features:
- Convert OpenAPI files from JSON → YAML or YAML → JSON
- Validate YAML/JSON file formats
- Export an OpenAPI YAML file as HTML for publishing
Prerequisites
- Python 3.8 or later
- make
Installation
Install using pip:
pip install swaggerizer
Verify the installation:
swgrzr --help
Quick start
Create a new swaggerizer project from your existing openapi.yaml file:
swgrzr create -i openapi.yaml
Create a new swaggerizer project from the default Petstore file:
swgrzr create
Build a testing version of the complete OpenAPI file from source:
cd openapi_src
make
Copy the current testing version of the OpenAPI file into the parent directory for publishing:
make final-build
Export the OpenAPI YAML file as HTML:
swgrzr export -i openapi.yaml
CLI usage
Syntax
swgrzr OPERATION [options]
Available operations
| Operation | Description |
|---|---|
| create | Create a new modularized project from an OpenAPI YAML file. |
| export | Export the input OpenAPI YAML as a rendered HTML document. |
| json2yaml | Convert an OpenAPI JSON file to YAML. |
| yaml2json | Convert an OpenAPI YAML file to JSON. |
| validate | Validate basic JSON or YAML structure. |
Common options
| Option | Description |
|---|---|
| -i, --input | Input file path. Defaults vary by operation. |
| -o, --output | Output file path. Defaults vary by operation. |
| -t, --type | Input type for validation (json, yaml). |
How it works
To create a modularized OpenAPI docs project, swaggerizer:
- Loads the source OpenAPI YAML.
- Detects the OpenAPI version (
v2orv3). - Extracts and groups the OpenAPI sections.
- Generates the modular project source directory.
- Adds the makefile to rebuild the spec.
Source code overview
swaggerizer/ # Metadata and packaging
├── swaggerizer/ # Python app source
│ ├── cli.py # CLI entry point
│ ├── files/ # Default assets
│ └── helpers/ # Helper modules
How to help
Feedback is appreciated!
Please:
- Report bugs or unexpected behavior.
- Propose enhancements to CLI commands or options.
To contribute:
- Fork the swaggerizer repo.
- Create a branch for your changes.
- Run tests before submitting.
- Open a pull request describing your changes and motivation.
Smaller, focused pull requests are preferred.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swaggerizer-0.1.1.tar.gz.
File metadata
- Download URL: swaggerizer-0.1.1.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02f4ace36393cfc2c0c54ee08f37b8f90510c6c55758bb6045e0f0e4ebb5c563
|
|
| MD5 |
b025536781d14c5692be88caab0d09c1
|
|
| BLAKE2b-256 |
c38f7dd973ea7f14124ff23cdf82424a210add12c8be0b123d113a2fccc2f004
|
Provenance
The following attestation bundles were made for swaggerizer-0.1.1.tar.gz:
Publisher:
publish-pypi.yml on jrhalterlein/swaggerizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swaggerizer-0.1.1.tar.gz -
Subject digest:
02f4ace36393cfc2c0c54ee08f37b8f90510c6c55758bb6045e0f0e4ebb5c563 - Sigstore transparency entry: 919034129
- Sigstore integration time:
-
Permalink:
jrhalterlein/swaggerizer@41d32f1eaebd5a0472db3bb29ad6f76cb833cad9 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/jrhalterlein
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@41d32f1eaebd5a0472db3bb29ad6f76cb833cad9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file swaggerizer-0.1.1-py3-none-any.whl.
File metadata
- Download URL: swaggerizer-0.1.1-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bc00ba54f0a6fc9c7e5a537122d9e329d8d568fde712696fb302a1885ebd850
|
|
| MD5 |
afee21284ef0ae72e4992bdf0e09d73f
|
|
| BLAKE2b-256 |
f59fee172f9fa4a03552772a5c7c37b5566adba0ae17b726e6c9b6a90b1a9bcc
|
Provenance
The following attestation bundles were made for swaggerizer-0.1.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on jrhalterlein/swaggerizer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swaggerizer-0.1.1-py3-none-any.whl -
Subject digest:
6bc00ba54f0a6fc9c7e5a537122d9e329d8d568fde712696fb302a1885ebd850 - Sigstore transparency entry: 919034134
- Sigstore integration time:
-
Permalink:
jrhalterlein/swaggerizer@41d32f1eaebd5a0472db3bb29ad6f76cb833cad9 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/jrhalterlein
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@41d32f1eaebd5a0472db3bb29ad6f76cb833cad9 -
Trigger Event:
push
-
Statement type: