
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
type-openapi
Advanced tools
$ref
pointers, including external files and URLsasync
/await
import "reflect-metadata";
import {Loader, OpenAPi} from 'type-openapi'
async function Example() {
const url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/api-with-examples.yaml"
const spec: OpenAPi = await Loader.loadFromURL(url)
console.log(spec)
}
callback
import "reflect-metadata";
import {CallbackLoader, OpenAPi} from 'type-openapi'
function Example() {
const url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/api-with-examples.yaml"
CallbackLoader.loadFromURL(url, (err: Error, spec: OpenApi) => {
if (err) {
console.log(err)
}
console.log(spec)
});
}
async
/await
require("reflect-metadata");
const {Loader} = require('type-openapi')
async function Example() {
const url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/api-with-examples.yaml"
const spec = await Loader.loadFromURL(url)
console.log(spec)
}
callback
require("reflect-metadata");
const {CallbackLoader} = require('type-openapi')
function Example() {
const url = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/api-with-examples.yaml"
CallbackLoader.loadFromURL(url, (err, spec) => {
if (err) {
console.log(err)
}
console.log(spec)
});
}
Install using npm:
Install module:
npm install type-openapi
reflect-metadata
shim is required, install it too:
npm install reflect-metadata
and make sure to import it in a global place, like app.ts:
import "reflect-metadata";
OR
require("reflect-metadata");
Full API documentation is available right here
I welcome any contributions, features, enhancements, and bug-fixes. File an issue on GitHub and submit a pull request.
Type OpenAPi is 100% free and open-source, under the MIT license. Use it however you want.
FAQs
Parse,Dereference Open API V3 Specification to Class Constructors
We found that type-openapi demonstrated a not healthy version release cadence and project activity because the last version was released 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.