Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jambff/oac

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jambff/oac - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

3

package.json
{
"name": "@jambff/oac",
"description": "A JavaScript OpenAPI client generator.",
"version": "1.0.0",
"version": "1.1.0",
"author": "Alex Mendes",

@@ -42,2 +42,3 @@ "license": "MIT",

"jwt-decode": "^3.1.2",
"node-fetch": "^2.6.1",
"openapi-types": "^11.0.0",

@@ -44,0 +45,0 @@ "openapi-typescript": "^4.0.0",

@@ -11,3 +11,3 @@ # OAC

- [Usage](#usage)
- [Models](#models)
- [Typescript](#typescript)
- [Authorization](#authorization)

@@ -38,2 +38,8 @@ - [Error handling](#error-handling)

```text
yarn oac http://example.api.com/docs.json
```
Alternatively, you can use a JSON file:
```text
yarn oac -f spec.json

@@ -154,11 +160,30 @@ ```

## Models
## Typescript
You can import TypeScript interfaces generated from the API server models via
`ApiModels`, for example:
Two types are generated for each API operation. One for the options
(`params`, `query` and `data`) and one for the response, for example:
```js
import {
createOpenApiClient,
MyExampleOptions,
MyExampleResponse,
} from '@jambff/oac';
const client = createOpenApiClient({ baseUrl: 'http://example.api.com' });
export const getMyExample = (
options: MyExampleOptions
): MyExampleResponse => (
client.myExampleOperation(options)
);
```
Types are also generated for each [OpenAPI component](https://swagger.io/docs/specification/components/)
present in your specification. These can be imported from `ApiComponents`, for example:
```ts
import { ApiModels } from '@jambff/client';
import { ApiComponents } from '@jambff/oac';
const post: ApiModels['Post'] = {
const post: ApiComponents['Post'] = {
title: 'My Post',

@@ -165,0 +190,0 @@ };

@@ -9,2 +9,2 @@ // @ts-ignore

export type ApiModels = components['schemas'];
export type ApiComponents = components['schemas'];
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc