Skip to main content

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:

  1. Loads the source OpenAPI YAML.
  2. Detects the OpenAPI version (v2 or v3).
  3. Extracts and groups the OpenAPI sections.
  4. Generates the modular project source directory.
  5. 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:

  1. Fork the swaggerizer repo.
  2. Create a branch for your changes.
  3. Run tests before submitting.
  4. Open a pull request describing your changes and motivation.

Smaller, focused pull requests are preferred.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swaggerizer-0.1.1.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swaggerizer-0.1.1-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

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

Hashes for swaggerizer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 02f4ace36393cfc2c0c54ee08f37b8f90510c6c55758bb6045e0f0e4ebb5c563
MD5 b025536781d14c5692be88caab0d09c1
BLAKE2b-256 c38f7dd973ea7f14124ff23cdf82424a210add12c8be0b123d113a2fccc2f004

See more details on using hashes here.

Provenance

The following attestation bundles were made for swaggerizer-0.1.1.tar.gz:

Publisher: publish-pypi.yml on jrhalterlein/swaggerizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for swaggerizer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6bc00ba54f0a6fc9c7e5a537122d9e329d8d568fde712696fb302a1885ebd850
MD5 afee21284ef0ae72e4992bdf0e09d73f
BLAKE2b-256 f59fee172f9fa4a03552772a5c7c37b5566adba0ae17b726e6c9b6a90b1a9bcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for swaggerizer-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on jrhalterlein/swaggerizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page