
Security News
Open VSX Begins Implementing Pre-Publish Security Checks After Repeated Supply Chain Incidents
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.
gofer-openapi
Advanced tools
gofer-openapiCLI and Library to assist in converting OpenAPI Specifications into working Gofer clients.

The basic idea is that this tool reads in an OpenAPI 3.x or 2.x specification
file and outputs a TypeScript file which contains all of the required type
declarations, as well as a definition of a class which extends Gofer.
You may then subclass this class to add a valid constructor as well as any hand-written methods you wish to add. By keeping the files separate, you are free to regenerate the auto-generated base class as often as you need (as the OpenAPI spec changes).
If you plan to use this regularly in your project, you may wish to install it locally first:
$ npm i gofer-openapi
For current CLI usage, see:
$ npx gofer-openapi --help
$ npx gofer-openapi \
--class=PetStoreBase \
< petstore.yml \
> petstore-base.ts
Now you can create your subclass:
// File: petstore.ts
import { PetStoreBase } from './petstore-base';
export * from './petstore-base';
export class PetStore extends PetStoreBase {
constructor() {
super({}, 'PetStore', '1.0.0');
}
addTwoDogs() {
return this.addPet([ /* ... */ ]);
}
}
And use it:
import { PetStore } from './petstore';
async function query() {
const client = new PetStore();
const res = await client.addTwoDogs();
const res2 = await client.someAutoGeneratedMethod();
}
$ npx gofer-openapi \
--class=PetStoreBase \
--format=js \
< petstore.yml \
> petstore-base.js
# optionally, but highly recommended, *also* run:
$ npx gofer-openapi \
--class=PetStoreBase \
--format=dts \
< petstore.yml \
> petstore-base.d.ts
This will get you a CommonJS JavaScript file and accompanying TypeScript declaration file, which you can now include in your existing JavaScript project without needing to transpile.
The class and usage examples above will basically work exactly the same.
import { readFile } from 'fs/promises';
import { goferFromOpenAPI } from 'gofer-openapi';
async function main() {
const typeScriptSrc = await goferFromOpenAPI(
await readFile('petstore.yml', 'utf8'),
{ className: 'PetStore', format: 'ts' }
);
// ...
}
See the the type declarations for full usage.
$ npm run watch
Runs the typescript compiler so you can edit the files in src/
FAQs
Gofer Openapi
We found that gofer-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
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.

Security News
Lodash 4.17.23 marks a security reset, with maintainers rebuilding governance and infrastructure to support long-term, sustainable maintenance.