swagroutes
swagroutes is a command-line tool that extracts and lists API routes from Swagger files in YAML or JSON format. It simplifies the process of fetching the routes provided by an API and supports processing multiple files or directories at once.
Install
pip install swagroutes
Upgrade
pip install -U swagroutes
Help
usage: swagroutes [-h] [-o OUTPUT] [-p] input [input ...]
Extract routes from Swagger files.
positional arguments:
input Input file(s) or directory containing Swagger files.
options:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output file to store the results.
-p, --include-params Include query parameters in the extracted routes.
Usage
To use swagroutes, simply provide input files or directories containing Swagger files as arguments. The tool will process the files and print the extracted routes.
Single YAML or JSON file
swagroutes file.yaml
swagroutes file.json
Multiple YAML and/or JSON files
swagroutes file1.yaml file2.json
Directory containing Swagger files
swagroutes directory/
Mix of files and directories
swagroutes file1.yaml directory1/ file2.json directory2/
Extract parameters
swagroutes file1.yaml --include-params
Output to a file
Save the extracted routes to an output file using the -o or --output option:
swagroutes file.yaml -o output.txt
Examples
Input:
basePath: /api
paths:
/users:
get: {}
post: {}
/profile/{profile_id}:
put: {}
Output:
GET /api/users
POST /api/users
PUT /api/profile/{profile_id}
Input:
basePath: /api/v1
paths:
/users:
get:
parameters:
- name: limit
in: query
- name: offset
in: query
/users/{userId}:
get:
parameters:
- name: userId
in: path
required: true
type: string
Output:
GET /api/v1/users/{userId}
GET /api/v1/users?limit&offset
Metadata
Release files for swagroutes 1.0.2
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 |
|---|---|---|---|---|
| swagroutes-1.0.2.tar.gz | 4.5 kB | Without provenance | Details for swagroutes-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swagroutes-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for swagroutes-1.0.2-py3-none-any.whl |
Total release size: 10.1 kB
Release files / swagroutes-1.0.2.tar.gz
| Download URL | swagroutes-1.0.2.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
11b4e889e15a9a88456f291843df66b46a48fc34d4513fb619b0741cba108488
|
|
BLAKE2b-256 checksum How to use checksums |
94432bb94019b9701c958bea01ff65828f4e728a2d22c584281605cc1d793058
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / swagroutes-1.0.2-py3-none-any.whl
| Download URL | swagroutes-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b0e3b1e34eb382900e125c4ebddc3147c0ef78e51794a6acfd02d57d6ae1802
|
|
BLAKE2b-256 checksum How to use checksums |
216bf4c75d01974d358d5c684d2983377cb71a91d555598bb243660f960b1b6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for swagroutes 1.0.2
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.