JSON Schemas for every version of the OpenAPI Specification
Installations
npm install openapi-schemas
Releases
Unable to fetch releases
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
>=10
Typescript Support
Yes
Node Version
10.24.1
NPM Version
6.14.12
Statistics
34 Stars
47 Commits
5 Forks
3 Watching
1 Branches
5 Contributors
Updated on 20 Aug 2024
Bundle Size
58.67 kB
Minified
6.94 kB
Minified + Gzipped
Languages
JavaScript (56.92%)
TypeScript (43.08%)
Total Downloads
Cumulative downloads
Total Downloads
28,747,336
Last day
-7.8%
10,960
Compared to previous day
Last week
3.5%
61,449
Compared to previous week
Last month
1.4%
254,069
Compared to previous month
Last year
-28.8%
3,154,195
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
OpenAPI Specification Schemas
This package contains the official JSON Schemas for every version of Swagger/OpenAPI Specification:
Version | Schema | Docs |
---|---|---|
Swagger 1.2 | v1.2 schema | v1.2 docs |
Swagger 2.0 | v2.0 schema | v2.0 docs |
OpenAPI 3.0.x | v3.0.x schema | v3.0.3 docs |
OpenAPI 3.1.x | v3.1.x schema | v3.1.0 docs |
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.
1npm install @apidevtools/openapi-schemas
Usage
The default export contains all OpenAPI Specification versions:
1const openapi = require("@apidevtools/openapi-schemas"); 2 3console.log(openapi.v1); // { $schema, id, properties, definitions, ... } 4console.log(openapi.v2); // { $schema, id, properties, definitions, ... } 5console.log(openapi.v3); // { $schema, id, properties, definitions, ... } 6console.log(openapi.v31); // { $schema, id, properties, definitions, ... }
Or you can import the specific version(s) that you need:
1const { openapiV1, openapiV2, openapiV3, openapiV31 } = require("@apidevtools/openapi-schemas"); 2 3console.log(openapiV1); // { $schema, id, properties, definitions, ... } 4console.log(openapiV2); // { $schema, id, properties, definitions, ... } 5console.log(openapiV3); // { $schema, id, properties, definitions, ... } 6console.log(openapiV31); // { $schema, id, properties, definitions, ... }
You can use a JSON Schema validator such as Z-Schema or AJV to validate OpenAPI definitions against the specification.
1const { openapiV31 } = require("@apidevtools/openapi-schemas"); 2const ZSchema = require("z-schema"); 3 4// Create a ZSchema validator 5let validator = new ZSchema(); 6 7// Validate an OpenAPI definition against the OpenAPI v3.0 specification 8validator.validate(openapiDefinition, openapiV31);
Contributing
Contributions, enhancements, and bug-fixes are welcome! Open 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.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
Big Thanks To
Thanks to these awesome companies for their support of Open Source developers ❤
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI-CD.yaml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/APIDevTools/openapi-schemas/CI-CD.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI-CD.yaml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/APIDevTools/openapi-schemas/CI-CD.yaml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/CI-CD.yaml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/APIDevTools/openapi-schemas/CI-CD.yaml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/CI-CD.yaml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/APIDevTools/openapi-schemas/CI-CD.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI-CD.yaml:83: update your workflow using https://app.stepsecurity.io/secureworkflow/APIDevTools/openapi-schemas/CI-CD.yaml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/CI-CD.yaml:86: update your workflow using https://app.stepsecurity.io/secureworkflow/APIDevTools/openapi-schemas/CI-CD.yaml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/CI-CD.yaml:95: update your workflow using https://app.stepsecurity.io/secureworkflow/APIDevTools/openapi-schemas/CI-CD.yaml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/CI-CD.yaml:106: update your workflow using https://app.stepsecurity.io/secureworkflow/APIDevTools/openapi-schemas/CI-CD.yaml/master?enable=pin
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 4 third-party GitHubAction dependencies pinned
- Info: 2 out of 2 npmCommand dependencies pinned
Reason
Found 1/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/CI-CD.yaml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 3 are checked with a SAST tool
Reason
20 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-g3ch-rx76-35fx
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
2.7
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More