@kubb/adapter-oas 5.0.0-beta.6 → 5.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@kubb/adapter-oas</h1>
|
|
3
|
+
<a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
|
|
4
|
+
<img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
|
|
5
|
+
</a>
|
|
6
|
+
|
|
7
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
8
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
9
|
+
[![Coverage][coverage-src]][coverage-href]
|
|
10
|
+
[![License][license-src]][license-href]
|
|
11
|
+
[![Sponsors][sponsors-src]][sponsors-href]
|
|
12
|
+
|
|
13
|
+
<h4>
|
|
14
|
+
<a href="https://kubb.dev/" target="_blank">Documentation</a>
|
|
15
|
+
<span> · </span>
|
|
16
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
|
|
17
|
+
<span> · </span>
|
|
18
|
+
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
|
|
19
|
+
</h4>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
OpenAPI and Swagger adapter for Kubb. Parses and validates Swagger 2.0, OpenAPI 3.0, and OpenAPI 3.1 specifications and transforms them into a `@kubb/ast` `RootNode` for downstream code generation plugins.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
bun add @kubb/adapter-oas
|
|
28
|
+
# or
|
|
29
|
+
pnpm add @kubb/adapter-oas
|
|
30
|
+
# or
|
|
31
|
+
npm install @kubb/adapter-oas
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
Use `adapterOas` inside your `kubb.config.ts`:
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { defineConfig } from 'kubb'
|
|
40
|
+
import { adapterOas } from '@kubb/adapter-oas'
|
|
41
|
+
|
|
42
|
+
export default defineConfig({
|
|
43
|
+
input: {
|
|
44
|
+
path: './openapi.yaml',
|
|
45
|
+
},
|
|
46
|
+
output: {
|
|
47
|
+
path: './src/gen',
|
|
48
|
+
},
|
|
49
|
+
adapters: [adapterOas()],
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
- Supports Swagger 2.0, OpenAPI 3.0, and OpenAPI 3.1
|
|
56
|
+
- Validates and dereferences `$ref` pointers
|
|
57
|
+
- Merges multi-document specs
|
|
58
|
+
- Outputs a `@kubb/ast` `RootNode` that every Kubb plugin reads from
|
|
59
|
+
- Re-exports typed helpers for operations, schemas, parameters, and responses
|
|
60
|
+
|
|
61
|
+
## API
|
|
62
|
+
|
|
63
|
+
### `adapterOas(options?)`
|
|
64
|
+
|
|
65
|
+
Creates the OAS adapter instance. Pass it in the `adapters` array of `defineConfig`.
|
|
66
|
+
|
|
67
|
+
### `mergeDocuments(documents)`
|
|
68
|
+
|
|
69
|
+
Merges multiple OpenAPI documents into a single document before parsing.
|
|
70
|
+
|
|
71
|
+
### Types
|
|
72
|
+
|
|
73
|
+
All OpenAPI types (`Document`, `Operation`, `SchemaObject`, `HttpMethod`, etc.) are re-exported from this package.
|
|
74
|
+
|
|
75
|
+
## Supporting Kubb
|
|
76
|
+
|
|
77
|
+
Kubb is an open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
|
|
78
|
+
|
|
79
|
+
- [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
|
|
80
|
+
|
|
81
|
+
<p align="center">
|
|
82
|
+
<a href="https://github.com/sponsors/stijnvanhulle">
|
|
83
|
+
<img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
|
|
84
|
+
</a>
|
|
85
|
+
</p>
|
|
86
|
+
|
|
87
|
+
<!-- Badges -->
|
|
88
|
+
|
|
89
|
+
[npm-version-src]: https://img.shields.io/npm/v/@kubb/adapter-oas?flat&colorA=18181B&colorB=f58517
|
|
90
|
+
[npm-version-href]: https://npmjs.com/package/@kubb/adapter-oas
|
|
91
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/adapter-oas?flat&colorA=18181B&colorB=f58517
|
|
92
|
+
[npm-downloads-href]: https://npmjs.com/package/@kubb/adapter-oas
|
|
93
|
+
[license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
|
|
94
|
+
[license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
|
|
95
|
+
[coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
|
|
96
|
+
[coverage-href]: https://www.npmjs.com/package/@kubb/adapter-oas
|
|
97
|
+
[sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
|
|
98
|
+
[sponsors-href]: https://github.com/sponsors/stijnvanhulle/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/adapter-oas",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
4
|
-
"description": "OpenAPI
|
|
3
|
+
"version": "5.0.0-beta.7",
|
|
4
|
+
"description": "OpenAPI and Swagger adapter for Kubb. Parses and validates OAS 2.0/3.x specifications into a @kubb/ast RootNode for downstream code generation plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adapter",
|
|
7
7
|
"codegen",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"oas": "^32.1.18",
|
|
48
48
|
"oas-normalize": "^16.0.4",
|
|
49
49
|
"swagger2openapi": "^7.0.8",
|
|
50
|
-
"@kubb/core": "5.0.0-beta.
|
|
50
|
+
"@kubb/core": "5.0.0-beta.7"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/swagger2openapi": "^7.0.4",
|