openapi-sorter
v1.0.1
Published
A tool to sort OpenAPI specification files
Downloads
51
Readme
OpenAPI Sorter
A tool to sort OpenAPI specification files for better readability and consistency.
Features
- Sort paths alphabetically
- Sort schemas alphabetically (with special handling for system schemas)
- Sort properties within schemas
Installation
Global Installation
npm install -g openapi-sorterLocal Installation
npm install openapi-sorterUsage
Command Line Interface
openapi-sorter ./path/to/your/openapi.jsonUsing Environment Variables
You can also use an environment variable to specify the file path:
Create a
.envfile in your project root with:TARGET_FILE_PATH=/path/to/your/openapi.jsonRun the tool:
npx openapi-sorter
How It Works
The tool reads your OpenAPI specification file, sorts the paths, schemas, and properties according to predefined rules, and then writes the sorted specification back to the file.
