Security News
Highlights from the 2024 Rails Community Survey
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
openapi3-ts
Advanced tools
The openapi3-ts npm package is a TypeScript library that provides types and utility functions for working with OpenAPI 3.0.x documents. It allows developers to create, manipulate, and validate OpenAPI specifications programmatically.
Creating OpenAPI documents
This feature allows developers to create new OpenAPI documents by defining the necessary OpenAPI object structure in TypeScript. The code sample represents a basic OpenAPI document structure with the required fields.
{"openApi": "3.0.0","info": {"title": "Sample API","version": "1.0.0"},"paths": {}}
Manipulating OpenAPI documents
This feature allows developers to add or modify paths, operations, and other components within an OpenAPI document. The code sample demonstrates adding a new path with a GET operation to an existing OpenAPI document.
{"openApi": "3.0.0","info": {"title": "Sample API","version": "1.0.0"},"paths": {"/pets": {"get": {"summary": "List all pets","operationId": "listPets","tags": ["pets"],"responses": {"200": {"description": "An paged array of pets"}}}}}}
Validating OpenAPI documents
This feature provides the ability to validate OpenAPI documents against the OpenAPI 3.0.x specification. The code sample shows how to create a validator instance and validate an OpenAPI document.
const OpenAPIValidator = require('openapi3-ts').OpenAPIValidator;const openApiDoc = {openApi: '3.0.0',info: {title: 'Sample API',version: '1.0.0'},paths: {}};const validator = new OpenAPIValidator(openApiDoc);const isValid = validator.validate();
This package allows you to integrate Swagger using JSDoc comments directly in your code. Unlike openapi3-ts, which is more about manipulating OpenAPI objects, swagger-jsdoc is focused on generating OpenAPI documentation from inline comments.
This package is used to serve auto-generated swagger-ui generated API docs from express, based on a swagger.json file. It is different from openapi3-ts in that it is more about serving and displaying documentation rather than creating or manipulating OpenAPI objects.
This package is an OpenAPI validator that validates API requests and responses against an OpenAPI document. It is similar to the validation functionality of openapi3-ts but is a standalone package dedicated to validation.
TypeScript library to help building OpenAPI 3.0.x compliant API contracts.
/src/model
TS typed interfaces for helping building a contract./src/dsl
Fluent DSL for building a contract.Install package via npm:
npm i --save openapi3-ts
Licensed under the MIT License.
Contact: Pedro J. Molina | github: pjmolina | twitter: pmolinam
(c) 2017-2018. Pedro J. Molina at Metadev S.L. https://metadev.pro
FAQs
TS Model & utils for OpenAPI 3.x specification.
The npm package openapi3-ts receives a total of 1,439,173 weekly downloads. As such, openapi3-ts popularity was classified as popular.
We found that openapi3-ts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A record 2,709 developers participated in the 2024 Ruby on Rails Community Survey, revealing key tools, practices, and trends shaping the Rails ecosystem.
Security News
In 2023, data breaches surged 78% from zero-day and supply chain attacks, but developers are still buried under alerts that are unable to prevent these threats.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.