@kubb/adapter-oas 5.7.0 → 5.8.1
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/OVERVIEW.md +29 -0
- package/dist/index.cjs +124 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +124 -114
- package/dist/index.js.map +1 -1
- package/kubb-extension.json +181 -0
- package/package.json +5 -2
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://kubb.dev/schemas/kubb-extension.json",
|
|
3
|
+
"kind": "adapter",
|
|
4
|
+
"name": "oas",
|
|
5
|
+
"export": "adapterOas",
|
|
6
|
+
"displayName": "OpenAPI",
|
|
7
|
+
"description": "Reads an OpenAPI 2.0, 3.0, or 3.1 spec and converts every schema and operation into the AST that Kubb plugins generate from.",
|
|
8
|
+
"category": "openapi",
|
|
9
|
+
"icon": {
|
|
10
|
+
"light": "https://kubb.dev/feature/openapi.svg"
|
|
11
|
+
},
|
|
12
|
+
"tags": ["openapi", "swagger", "api-spec", "parser", "converter"],
|
|
13
|
+
"docs": "https://kubb.dev/adapters/adapter-oas",
|
|
14
|
+
"compatibility": {
|
|
15
|
+
"kubb": ">=5.8.0",
|
|
16
|
+
"node": ">=22"
|
|
17
|
+
},
|
|
18
|
+
"options": [
|
|
19
|
+
{
|
|
20
|
+
"key": "validate",
|
|
21
|
+
"path": ["validate"],
|
|
22
|
+
"label": "Validate",
|
|
23
|
+
"description": "Validate the spec before parsing. Each problem is reported as a warning and generation continues. Turn it off to speed up a large spec.",
|
|
24
|
+
"type": "boolean",
|
|
25
|
+
"default": true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"key": "dateType",
|
|
29
|
+
"path": ["dateType"],
|
|
30
|
+
"label": "Date Type",
|
|
31
|
+
"description": "How date-time, date, and time schemas are represented.",
|
|
32
|
+
"type": "select",
|
|
33
|
+
"default": "string",
|
|
34
|
+
"choices": [
|
|
35
|
+
{
|
|
36
|
+
"label": "string (ISO 8601)",
|
|
37
|
+
"value": "string"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"label": "stringOffset (with timezone offset)",
|
|
41
|
+
"value": "stringOffset"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"label": "stringLocal (without timezone)",
|
|
45
|
+
"value": "stringLocal"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"label": "date (JavaScript Date)",
|
|
49
|
+
"value": "date"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"label": "false (plain string, no validation)",
|
|
53
|
+
"value": false
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"key": "integerType",
|
|
59
|
+
"path": ["integerType"],
|
|
60
|
+
"label": "Integer Type",
|
|
61
|
+
"description": "How integer and int64 schemas map to TypeScript.",
|
|
62
|
+
"type": "select",
|
|
63
|
+
"default": "bigint",
|
|
64
|
+
"choices": [
|
|
65
|
+
{
|
|
66
|
+
"label": "bigint (exact for 64-bit IDs)",
|
|
67
|
+
"value": "bigint"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"label": "number (fits most JSON APIs)",
|
|
71
|
+
"value": "number"
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"key": "unknownType",
|
|
77
|
+
"path": ["unknownType"],
|
|
78
|
+
"label": "Unknown Type",
|
|
79
|
+
"description": "Type used when a schema's type cannot be inferred from the spec.",
|
|
80
|
+
"type": "select",
|
|
81
|
+
"default": "unknown",
|
|
82
|
+
"choices": [
|
|
83
|
+
{
|
|
84
|
+
"label": "unknown",
|
|
85
|
+
"value": "unknown"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"label": "any",
|
|
89
|
+
"value": "any"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"label": "void",
|
|
93
|
+
"value": "void"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"key": "emptySchemaType",
|
|
99
|
+
"path": ["emptySchemaType"],
|
|
100
|
+
"label": "Empty Schema Type",
|
|
101
|
+
"description": "Type used for empty schemas ({}). Follows Unknown Type when unset.",
|
|
102
|
+
"type": "select",
|
|
103
|
+
"choices": [
|
|
104
|
+
{
|
|
105
|
+
"label": "same as Unknown Type",
|
|
106
|
+
"value": null
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"label": "unknown",
|
|
110
|
+
"value": "unknown"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"label": "any",
|
|
114
|
+
"value": "any"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"label": "void",
|
|
118
|
+
"value": "void"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"key": "enumSuffix",
|
|
124
|
+
"path": ["enumSuffix"],
|
|
125
|
+
"label": "Enum Suffix",
|
|
126
|
+
"description": "Suffix for enum names Kubb derives, such as PetStatusEnum.",
|
|
127
|
+
"type": "text",
|
|
128
|
+
"default": "enum"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"key": "contentType",
|
|
132
|
+
"path": ["contentType"],
|
|
133
|
+
"label": "Content Type",
|
|
134
|
+
"description": "Preferred media type when an operation defines several. Defaults to the first JSON media type in the spec.",
|
|
135
|
+
"type": "text"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"key": "serverIndex",
|
|
139
|
+
"path": ["server", "index"],
|
|
140
|
+
"label": "Server Index",
|
|
141
|
+
"description": "Index in the spec's servers array that resolves the base URL. Leave empty for no base URL.",
|
|
142
|
+
"type": "number"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"key": "discriminator",
|
|
146
|
+
"path": ["discriminator"],
|
|
147
|
+
"label": "Discriminator",
|
|
148
|
+
"description": "How discriminator fields on oneOf and anyOf schemas are interpreted.",
|
|
149
|
+
"type": "select",
|
|
150
|
+
"default": "preserve",
|
|
151
|
+
"choices": [
|
|
152
|
+
{
|
|
153
|
+
"label": "preserve (keep child schemas as written)",
|
|
154
|
+
"value": "preserve"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"label": "propagate (add the literal value to each child)",
|
|
158
|
+
"value": "propagate"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"key": "enums",
|
|
164
|
+
"path": ["enums"],
|
|
165
|
+
"label": "Enums",
|
|
166
|
+
"description": "Where inline enums live.",
|
|
167
|
+
"type": "select",
|
|
168
|
+
"default": "inline",
|
|
169
|
+
"choices": [
|
|
170
|
+
{
|
|
171
|
+
"label": "inline (on the property)",
|
|
172
|
+
"value": "inline"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"label": "root (reusable top-level schema)",
|
|
176
|
+
"value": "root"
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/adapter-oas",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.1",
|
|
4
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",
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
],
|
|
37
37
|
"files": [
|
|
38
38
|
"dist",
|
|
39
|
+
"kubb-extension.json",
|
|
40
|
+
"OVERVIEW.md",
|
|
39
41
|
"!/**/**.test.**",
|
|
40
42
|
"!/**/__tests__/**",
|
|
41
43
|
"!/**/__snapshots__/**"
|
|
@@ -51,6 +53,7 @@
|
|
|
51
53
|
"import": "./dist/index.js",
|
|
52
54
|
"require": "./dist/index.cjs"
|
|
53
55
|
},
|
|
56
|
+
"./kubb-extension.json": "./kubb-extension.json",
|
|
54
57
|
"./package.json": "./package.json"
|
|
55
58
|
},
|
|
56
59
|
"publishConfig": {
|
|
@@ -58,7 +61,7 @@
|
|
|
58
61
|
"registry": "https://registry.npmjs.org/"
|
|
59
62
|
},
|
|
60
63
|
"dependencies": {
|
|
61
|
-
"@kubb/kit": "5.
|
|
64
|
+
"@kubb/kit": "5.8.1",
|
|
62
65
|
"@readme/openapi-parser": "^9.1.0",
|
|
63
66
|
"@scalar/openapi-upgrader": "^0.4.3",
|
|
64
67
|
"api-ref-bundler": "0.5.1",
|