OpenAPI Specification Schemas
This package contains the official JSON Schemas for every version of Swagger/OpenAPI Specification:
All schemas are kept up-to-date with the latest official definitions via an automated CI/CD job. 🤖📦
Installation
You can install OpenAPI Schemas via npm.
npm install @apidevtools/openapi-schemas
Usage
The default export contains all OpenAPI Specification versions:
const openapi = require("@apidevtools/openapi-schemas");
console.log(openapi.v1);
console.log(openapi.v2);
console.log(openapi.v3);
Or you can import the specific version(s) that you need:
const { openapiV1, openapiV2, openapiV3 } = require("@apidevtools/openapi-schemas");
console.log(openapiV1);
console.log(openapiV2);
console.log(openapiV3);
You can use a JSON Schema validator such as Z-Schema or AJV to validate OpenAPI definitions against the specification.
const { openapiV3 } = require("@apidevtools/openapi-schemas");
const ZSchema = require("z-schema");
let validator = new ZSchema();
validator.validate(openapiDefinition, openapiV3);
Contributing
Contributions, enhancements, and bug-fixes are welcome! File an issue on GitHub and submit a pull request.
Building
To build the project locally on your computer:
-
Clone this repo
git clone https://github.com/APIDevTools/openapi-schemas.git
-
Install dependencies
npm install
-
Build the code
npm run build
-
Run the tests
npm test
License
OpenAPI Schemas is 100% free and open-source, under the MIT license. Use it however you want.
Big Thanks To
Thanks to these awesome companies for their support of Open Source developers ❤