Managing large OpenAPI files can be a hassle, especially when you only need a small portion of the API for specific tasks. This is where OpenAPI Trimmer comes in handy. It's a lightweight tool designed to trim down your OpenAPI files to include only the endpoints and data transfer objects (DTOs) you care about.
Let's say you're working with a large OpenAPI file, but you only need the endpoints related to the Quotes API. You can easily extract just those endpoints and remove irrelevant DTOs with a single command:
openapi-trimmer -i openapi.yaml \ -p /v1/quotes,/v1/users \ -ec CompanyConfigDto,UpdateCompanyConfigDto
This command will:
The trimmed API definition will be saved as openapi-trimmer.yaml.
To ensure the integrity of your trimmed OpenAPI file, validate it with:
swagger-cli validate ./openapi-trimmer.yaml
This step helps catch any issues before you deploy or share the trimmed API file.
You can install OpenAPI Trimmer directly from PyPi:
pip install openapi-trimmer
For more details and the latest updates, visit the OpenAPI Trimmer PyPi page.
GitHub repository: OpenAPI Trimmer on GitHub.
The OpenAPI Trimmer offers several options to customize its operation:
OpenAPI Trimmer is an essential tool for developers looking to streamline their OpenAPI files, making them more manageable and tailored to specific needs. Whether you're preparing API documentation or simplifying an API for internal use, OpenAPI Trimmer saves you time and effort by focusing only on what matters most to you.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3