Skip to main content

Generate Markdown from an openapi JSON file.

Project description

OpenAPI Readme Generator

Generates Markdown suitable for a README file from a local openapi.json file.

I still plan to add more features to this tool, but it is already useful for generating basic API documentation in Markdown from an OpenAPI schema.

Installation

This tool can be installed via uv, poetry or pip depending on your needs:

This tool is usually only needed during development, so it is recommended to install it as a development dependency.

uv:

uv add --dev openapi-readme

Poetry:

poetry add openapi-readme --group dev

Or Pip:

pip install openapi-readme

This will install the openapi-readme command line tool.

Usage

openapi-readme [OPTIONS]

Run this in the same directory as your openapi.json file. By default the Markdown output will be printed to the console, but you can redirect it out to a file too.

The particular styling of the generated Markdown is currently hardcoded, though plans are afoot to implement some sort of themeing.

Options Summary

  • --route-level INTEGER: Number of heading levels to use. [default: 4]
  • --inject / --no-inject: Inject generated output into a README file. [default: False]
  • --help: Show this message and exit.

Options in Detail

--route-level

Specify the heading level for each Route in the generated documentation. This defaults to 4 if not specified, ie:

#### **`GET`** _/user/list_

--inject

Injects the new Markdown directly into a README.md file in the current directory, if it is found. You need to add the placeholder comment <!-- openapi-schema --> to your markdown where you want it to be injected:

This is some preceeding text

### API Schema description
<!-- openapi-schema -->

### Next section
The document continues unaffected after the injection.

Existing (previously injected) Schemas will be replaced by this new data.

TODO

Future improvement plans

  • Take more info from the openapi.json file

Contributing

All PRs to add features of fix bugs are very welcome!

Please read the CODE_OF_CONDUCT.md and CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License as reproduced below:

    Copyright (c) 2022-2024 Grant Ramsay

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.

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

openapi_readme-0.4.0.tar.gz (80.6 kB view details)

Uploaded Source

Built Distribution

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

openapi_readme-0.4.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file openapi_readme-0.4.0.tar.gz.

File metadata

  • Download URL: openapi_readme-0.4.0.tar.gz
  • Upload date:
  • Size: 80.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for openapi_readme-0.4.0.tar.gz
Algorithm Hash digest
SHA256 db5af0908ae386b5b5c27e3f24980aa367fe94214c6705018c6f93590bab839a
MD5 94d1cdccf1239a3a39174a1563ef7614
BLAKE2b-256 77c82c167736641c260bdcb42cfa35865d15029767f7f85ab95f49a59b58cab6

See more details on using hashes here.

File details

Details for the file openapi_readme-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openapi_readme-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c03bc644cc390dd2b6963b59c1cd2f60273e1a1a1ad3e3069c9fcd492c74a6ce
MD5 a6272ef27af44425d8cffc5e2e0c12e6
BLAKE2b-256 0aa19ce9674e9525df01da0a90801f7920a29876d2d0278f012b4be3da1eae73

See more details on using hashes here.

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