
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
openapi-typegen
Advanced tools
Generates typescript code to access your api based on the openapi (swagger) json files. The generated files are completely typesafe. This library supports only openapi schemas with the version 3.
With npm
$ npm install --global openapi-typegen`
With yarn
$ yarn global add openapi-typegen
$ typegen --src <path-or-url-to-schema> --out <output-directory>
For example
$ typegen --src http://localhost:8080/v2/api-docs --out ./generated
import { createApi } from './generated/create-api';
const api = createApi({
baseUrl: 'http://localhost:8000/api' // Override the base url the default is the url from the first server in the schema
});
// Now you can use the api as the following. The function names will be generated
// based on the operationIds
api.findPetsByTags({
query: {
tags: ['available']
}
})
.then(response => console.log(`Found pets ${response.data}`))
.catch(error => console.error('Error while searching pets'));
For an example of the generated files please take a look at the pet-store example.
FAQs
Generate typescript from swagger files
The npm package openapi-typegen receives a total of 77 weekly downloads. As such, openapi-typegen popularity was classified as not popular.
We found that openapi-typegen 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.