@kubb/oas 3.0.0-alpha.3 → 3.0.0-alpha.31
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 +13 -4
- package/dist/{Oas-BEe7KZDj.d.cts → Oas-Br0yKhGF.d.cts} +3 -0
- package/dist/{Oas-BEe7KZDj.d.ts → Oas-Br0yKhGF.d.ts} +3 -0
- package/dist/chunk-JAZKMYLT.cjs +244 -0
- package/dist/chunk-JAZKMYLT.cjs.map +1 -0
- package/dist/chunk-PHE7X6W6.js +230 -0
- package/dist/chunk-PHE7X6W6.js.map +1 -0
- package/dist/index.cjs +37 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -432
- package/dist/index.d.ts +7 -432
- package/dist/index.js +4 -21
- package/dist/index.js.map +1 -1
- package/dist/infer.cjs +4 -0
- package/dist/infer.cjs.map +1 -0
- package/dist/infer.d.cts +380 -0
- package/dist/infer.d.ts +380 -0
- package/dist/infer.js +3 -0
- package/dist/infer.js.map +1 -0
- package/dist/parser.cjs +18 -18
- package/dist/parser.cjs.map +1 -1
- package/dist/parser.d.cts +3 -44
- package/dist/parser.d.ts +3 -44
- package/dist/parser.js +11 -18
- package/dist/parser.js.map +1 -1
- package/package.json +19 -12
- package/src/Oas.ts +69 -5
- package/src/index.ts +0 -2
- package/src/parser/index.ts +6 -52
- package/src/utils.ts +1 -49
- package/dist/chunk-7D7ASOLY.js +0 -242
- package/dist/chunk-7D7ASOLY.js.map +0 -1
- package/dist/chunk-UIWP4KHB.cjs +0 -242
- package/dist/chunk-UIWP4KHB.cjs.map +0 -1
- package/src/typings.d.ts +0 -51
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/oas",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.31",
|
|
4
4
|
"description": "Oas helpers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
"require": "./dist/parser.cjs",
|
|
29
29
|
"default": "./dist/parser.cjs"
|
|
30
30
|
},
|
|
31
|
+
"./infer": {
|
|
32
|
+
"import": "./dist/infer.js",
|
|
33
|
+
"require": "./dist/infer.cjs",
|
|
34
|
+
"default": "./dist/infer.cjs"
|
|
35
|
+
},
|
|
31
36
|
"./package.json": "./package.json",
|
|
32
37
|
"./*": "./*"
|
|
33
38
|
},
|
|
@@ -38,6 +43,9 @@
|
|
|
38
43
|
"*": {
|
|
39
44
|
"parser": [
|
|
40
45
|
"./dist/parser.d.ts"
|
|
46
|
+
],
|
|
47
|
+
"infer": [
|
|
48
|
+
"./dist/infer.d.ts"
|
|
41
49
|
]
|
|
42
50
|
}
|
|
43
51
|
},
|
|
@@ -48,14 +56,14 @@
|
|
|
48
56
|
"!/**/__tests__/**"
|
|
49
57
|
],
|
|
50
58
|
"dependencies": {
|
|
51
|
-
"@redocly/openapi-core": "^1.
|
|
59
|
+
"@redocly/openapi-core": "^1.25.3",
|
|
52
60
|
"hotscript": "^1.0.13",
|
|
53
|
-
"json-schema-to-ts": "^3.1.
|
|
54
|
-
"
|
|
55
|
-
"oas
|
|
56
|
-
"
|
|
61
|
+
"json-schema-to-ts": "^3.1.1",
|
|
62
|
+
"jsonpointer": "^5.0.1",
|
|
63
|
+
"oas": "^25.0.1",
|
|
64
|
+
"oas-normalize": "^11.1.2",
|
|
57
65
|
"openapi-types": "^12.1.3",
|
|
58
|
-
"remeda": "^2.
|
|
66
|
+
"remeda": "^2.14.0",
|
|
59
67
|
"swagger2openapi": "^7.0.8",
|
|
60
68
|
"ts-toolbelt": "^9.6.0"
|
|
61
69
|
},
|
|
@@ -63,11 +71,10 @@
|
|
|
63
71
|
"@stoplight/yaml": "^4.3.0",
|
|
64
72
|
"@types/swagger2openapi": "^7.0.4",
|
|
65
73
|
"expect-type": "^0.19.0",
|
|
66
|
-
"tsup": "^8.
|
|
67
|
-
"typescript": "^5.
|
|
68
|
-
"@kubb/config-
|
|
69
|
-
"@kubb/config-
|
|
70
|
-
"@kubb/config-tsup": "3.0.0-alpha.3"
|
|
74
|
+
"tsup": "^8.3.0",
|
|
75
|
+
"typescript": "^5.6.2",
|
|
76
|
+
"@kubb/config-ts": "3.0.0-alpha.31",
|
|
77
|
+
"@kubb/config-tsup": "3.0.0-alpha.31"
|
|
71
78
|
},
|
|
72
79
|
"engines": {
|
|
73
80
|
"node": ">=20"
|
package/src/Oas.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import BaseOas from 'oas'
|
|
2
2
|
import OASNormalize from 'oas-normalize'
|
|
3
|
-
import {
|
|
3
|
+
import { matchesMimeType } from 'oas/utils'
|
|
4
|
+
|
|
5
|
+
import jsonpointer from 'jsonpointer'
|
|
4
6
|
|
|
5
7
|
import { isReference } from './utils.ts'
|
|
6
8
|
|
|
7
9
|
import type { Operation } from 'oas/operation'
|
|
8
10
|
import type { MediaTypeObject, OASDocument, ResponseObject, SchemaObject, User } from 'oas/types'
|
|
11
|
+
import type { OasTypes, OpenAPIV3 } from './index.ts'
|
|
9
12
|
import type { contentType } from './types.ts'
|
|
10
13
|
|
|
11
14
|
type Options = {
|
|
@@ -27,10 +30,72 @@ export class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
27
30
|
this.#options = options
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
get($ref: string) {
|
|
34
|
+
const origRef = $ref
|
|
35
|
+
$ref = $ref.trim()
|
|
36
|
+
if ($ref === '') {
|
|
37
|
+
return false
|
|
38
|
+
}
|
|
39
|
+
if ($ref.startsWith('#')) {
|
|
40
|
+
$ref = globalThis.decodeURIComponent($ref.substring(1))
|
|
41
|
+
} else {
|
|
42
|
+
throw new Error(`Could not find a definition for ${origRef}.`)
|
|
43
|
+
}
|
|
44
|
+
const current = jsonpointer.get(this.api, $ref)
|
|
45
|
+
|
|
46
|
+
if (!current) {
|
|
47
|
+
throw new Error(`Could not find a definition for ${origRef}.`)
|
|
48
|
+
}
|
|
49
|
+
return current
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
set($ref: string, value: unknown) {
|
|
53
|
+
const origRef = $ref
|
|
54
|
+
$ref = $ref.trim()
|
|
55
|
+
if ($ref === '') {
|
|
56
|
+
return false
|
|
57
|
+
}
|
|
58
|
+
if ($ref.startsWith('#')) {
|
|
59
|
+
$ref = globalThis.decodeURIComponent($ref.substring(1))
|
|
60
|
+
} else {
|
|
61
|
+
throw new Error(`Could not find a definition for ${origRef}.`)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
jsonpointer.set(this.api, $ref, value)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
resolveDiscriminators(): void {
|
|
68
|
+
const schemas = (this.api.components?.schemas || {}) as Record<string, OasTypes.SchemaObject>
|
|
69
|
+
|
|
70
|
+
Object.entries(schemas).forEach(([key, schemaObject]) => {
|
|
71
|
+
if ('discriminator' in schemaObject) {
|
|
72
|
+
const { mapping = {}, propertyName } = (schemaObject.discriminator || {}) as OpenAPIV3.DiscriminatorObject
|
|
73
|
+
|
|
74
|
+
Object.entries(mapping).forEach(([mappingKey, mappingValue]) => {
|
|
75
|
+
if (mappingValue) {
|
|
76
|
+
const childSchema = this.get(mappingValue)
|
|
77
|
+
const property = childSchema.properties?.[propertyName] as SchemaObject
|
|
78
|
+
|
|
79
|
+
if (property) {
|
|
80
|
+
childSchema.properties[propertyName] = {
|
|
81
|
+
...childSchema.properties[propertyName],
|
|
82
|
+
enum: [...(property?.enum?.filter((value) => value !== mappingKey) ?? []), mappingKey],
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
childSchema.required = [...(childSchema.required ?? []), propertyName]
|
|
86
|
+
|
|
87
|
+
this.set(mappingValue, childSchema)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
30
95
|
dereferenceWithRef(schema?: unknown) {
|
|
31
96
|
if (isReference(schema)) {
|
|
32
97
|
return {
|
|
33
|
-
...
|
|
98
|
+
...this.get(schema.$ref),
|
|
34
99
|
$ref: schema.$ref,
|
|
35
100
|
}
|
|
36
101
|
}
|
|
@@ -102,7 +167,7 @@ export class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
102
167
|
const $ref = isReference(schema) ? schema.$ref : undefined
|
|
103
168
|
|
|
104
169
|
if (schema && $ref) {
|
|
105
|
-
operation.schema.responses![key] =
|
|
170
|
+
operation.schema.responses![key] = this.get($ref)
|
|
106
171
|
}
|
|
107
172
|
})
|
|
108
173
|
}
|
|
@@ -194,11 +259,10 @@ export class Oas<const TOAS = unknown> extends BaseOas {
|
|
|
194
259
|
})
|
|
195
260
|
|
|
196
261
|
await oasNormalize.validate({
|
|
262
|
+
convertToLatest: true,
|
|
197
263
|
parser: {
|
|
198
264
|
validate: {
|
|
199
265
|
colorizeErrors: true,
|
|
200
|
-
schema: false,
|
|
201
|
-
spec: false,
|
|
202
266
|
},
|
|
203
267
|
},
|
|
204
268
|
})
|
package/src/index.ts
CHANGED
package/src/parser/index.ts
CHANGED
|
@@ -1,62 +1,20 @@
|
|
|
1
|
+
import { bundle, loadConfig } from '@redocly/openapi-core'
|
|
1
2
|
import OASNormalize from 'oas-normalize'
|
|
2
3
|
import swagger2openapi from 'swagger2openapi'
|
|
3
|
-
import { bundle, loadConfig } from '@redocly/openapi-core'
|
|
4
4
|
|
|
5
5
|
import { Oas } from '../Oas.ts'
|
|
6
|
-
import {
|
|
6
|
+
import { isOpenApiV2Document } from '../utils.ts'
|
|
7
7
|
|
|
8
8
|
import type { OASDocument } from 'oas/types'
|
|
9
9
|
import type { OpenAPI } from 'openapi-types'
|
|
10
10
|
|
|
11
|
-
export
|
|
12
|
-
verbose?: boolean
|
|
13
|
-
'no-sort'?: boolean
|
|
14
|
-
sort?: boolean
|
|
15
|
-
output?: string
|
|
16
|
-
sortSet?: {
|
|
17
|
-
root?: Array<'openapi' | 'info' | 'servers' | 'paths' | 'components' | 'tags' | 'x-tagGroups' | 'externalDocs'>
|
|
18
|
-
get?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
|
|
19
|
-
post?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
|
|
20
|
-
put?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
|
|
21
|
-
patch?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
|
|
22
|
-
delete?: Array<'operationId' | 'summary' | 'description' | 'parameters' | 'requestBody' | 'responses'>
|
|
23
|
-
parameters?: Array<'name' | 'in' | 'description' | 'required' | 'schema'>
|
|
24
|
-
requestBody?: Array<'description' | 'required' | 'content'>
|
|
25
|
-
responses?: Array<'description' | 'headers' | 'content' | 'links'>
|
|
26
|
-
content?: Array<string>
|
|
27
|
-
components?: Array<'parameters' | 'schemas'>
|
|
28
|
-
schema?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
|
|
29
|
-
schemas?: Array<'description' | 'type' | 'items' | 'properties' | 'format' | 'example' | 'default'>
|
|
30
|
-
properties?: Array<'description' | 'type' | 'items' | 'format' | 'example' | 'default' | 'enum'>
|
|
31
|
-
}
|
|
32
|
-
filterSet?: {
|
|
33
|
-
methods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete' | 'options' | 'trace' | 'head' | 'parameters'>
|
|
34
|
-
inverseMethods?: Array<'get' | 'post' | 'put' | 'patch' | 'delete' | 'options' | 'trace' | 'head' | 'parameters'>
|
|
35
|
-
tags?: Array<string>
|
|
36
|
-
inverseTags?: Array<string>
|
|
37
|
-
operationIds?: Array<string>
|
|
38
|
-
inverseOperationIds?: Array<string>
|
|
39
|
-
operations?: Array<string>
|
|
40
|
-
flags?: Array<string>
|
|
41
|
-
inverseFlags?: Array<string>
|
|
42
|
-
flagValues?: Array<string>
|
|
43
|
-
inverseFlagValues?: Array<string>
|
|
44
|
-
stripFlags?: Array<string>
|
|
45
|
-
responseContent?: Array<string>
|
|
46
|
-
inverseResponseContent?: Array<string>
|
|
47
|
-
unusedComponents?: Array<'requestBodies' | 'schemas' | 'parameters' | 'responses'>
|
|
48
|
-
}
|
|
49
|
-
sortComponentsSet?: {}
|
|
50
|
-
casingSet?: {}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export async function parse(pathOrApi: string | OASDocument, options: FormatOptions = {}, oasClass: typeof Oas = Oas): Promise<Oas> {
|
|
11
|
+
export async function parse(pathOrApi: string | OASDocument, oasClass: typeof Oas = Oas): Promise<Oas> {
|
|
54
12
|
if (typeof pathOrApi === 'string') {
|
|
55
13
|
// resolve external refs
|
|
56
14
|
const config = await loadConfig()
|
|
57
15
|
const bundleResults = await bundle({ ref: pathOrApi, config, base: pathOrApi })
|
|
58
16
|
|
|
59
|
-
return parse(bundleResults.bundle.parsed
|
|
17
|
+
return parse(bundleResults.bundle.parsed)
|
|
60
18
|
}
|
|
61
19
|
|
|
62
20
|
const oasNormalize = new OASNormalize(pathOrApi, {
|
|
@@ -70,12 +28,8 @@ export async function parse(pathOrApi: string | OASDocument, options: FormatOpti
|
|
|
70
28
|
anchors: true,
|
|
71
29
|
})
|
|
72
30
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return new oasClass({ oas: oas as OASDocument })
|
|
31
|
+
return new oasClass({ oas: openapi as OASDocument })
|
|
76
32
|
}
|
|
77
33
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return new oasClass({ oas })
|
|
34
|
+
return new oasClass({ oas: document })
|
|
81
35
|
}
|
package/src/utils.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { isRef, isSchema } from 'oas/types'
|
|
2
|
-
import openapiFormat from 'openapi-format'
|
|
3
2
|
import { isPlainObject } from 'remeda'
|
|
4
3
|
|
|
5
|
-
import type {
|
|
4
|
+
import type { ParameterObject, SchemaObject } from 'oas/types'
|
|
6
5
|
import type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types'
|
|
7
|
-
import type { FormatOptions } from './parser/index.ts'
|
|
8
6
|
|
|
9
7
|
export function isOpenApiV2Document(doc: any): doc is OpenAPIV2.Document {
|
|
10
8
|
return doc && isPlainObject(doc) && !('openapi' in doc)
|
|
@@ -40,49 +38,3 @@ export function isRequired(schema?: SchemaObject): boolean {
|
|
|
40
38
|
export function isOptional(schema?: SchemaObject): boolean {
|
|
41
39
|
return !isRequired(schema)
|
|
42
40
|
}
|
|
43
|
-
|
|
44
|
-
export async function filterAndSort(data: OASDocument, options: FormatOptions = {}): Promise<OASDocument> {
|
|
45
|
-
const mergedOptions: FormatOptions = {
|
|
46
|
-
sort: options.sort ?? true,
|
|
47
|
-
['no-sort']: options['no-sort'] ?? false,
|
|
48
|
-
sortSet: {
|
|
49
|
-
root: ['openapi', 'info', 'servers', 'paths', 'components', 'tags', 'x-tagGroups', 'externalDocs'],
|
|
50
|
-
get: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],
|
|
51
|
-
post: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],
|
|
52
|
-
put: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],
|
|
53
|
-
patch: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],
|
|
54
|
-
delete: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],
|
|
55
|
-
parameters: ['name', 'in', 'description', 'required', 'schema'],
|
|
56
|
-
requestBody: ['description', 'required', 'content'],
|
|
57
|
-
responses: ['description', 'headers', 'content', 'links'],
|
|
58
|
-
content: [],
|
|
59
|
-
components: ['parameters', 'schemas'],
|
|
60
|
-
schema: ['description', 'type', 'items', 'properties', 'format', 'example', 'default'],
|
|
61
|
-
schemas: ['description', 'type', 'items', 'properties', 'format', 'example', 'default'],
|
|
62
|
-
properties: ['description', 'type', 'items', 'format', 'example', 'default', 'enum'],
|
|
63
|
-
...options.sortSet,
|
|
64
|
-
},
|
|
65
|
-
sortComponentsSet: {
|
|
66
|
-
...options.sortComponentsSet,
|
|
67
|
-
},
|
|
68
|
-
filterSet: {
|
|
69
|
-
inverseMethods: ['get', 'put', 'post', 'delete', 'patch', 'head', 'options', 'trace', 'parameters'],
|
|
70
|
-
unusedComponents: options.filterSet ? ['requestBodies', 'schemas', 'parameters', 'responses'] : [],
|
|
71
|
-
...options.filterSet,
|
|
72
|
-
},
|
|
73
|
-
casingSet: {
|
|
74
|
-
...options.casingSet,
|
|
75
|
-
},
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const restFilter = await openapiFormat.openapiFilter(data, mergedOptions)
|
|
79
|
-
data = restFilter.data
|
|
80
|
-
|
|
81
|
-
const resFormat = await openapiFormat.openapiSort(data, mergedOptions)
|
|
82
|
-
data = resFormat.data
|
|
83
|
-
|
|
84
|
-
const resChangeCase = await openapiFormat.openapiChangeCase(data, mergedOptions)
|
|
85
|
-
data = resChangeCase.data
|
|
86
|
-
|
|
87
|
-
return data
|
|
88
|
-
}
|
package/dist/chunk-7D7ASOLY.js
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
var __typeError = (msg) => {
|
|
2
|
-
throw TypeError(msg);
|
|
3
|
-
};
|
|
4
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
8
|
-
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
9
|
-
|
|
10
|
-
// src/utils.ts
|
|
11
|
-
import { isRef, isSchema } from "oas/types";
|
|
12
|
-
import openapiFormat from "openapi-format";
|
|
13
|
-
import { isPlainObject } from "remeda";
|
|
14
|
-
function isOpenApiV2Document(doc) {
|
|
15
|
-
return doc && isPlainObject(doc) && !("openapi" in doc);
|
|
16
|
-
}
|
|
17
|
-
function isOpenApiV3_1Document(doc) {
|
|
18
|
-
return doc && isPlainObject(doc) && "openapi" in doc && doc.openapi.startsWith("3.1");
|
|
19
|
-
}
|
|
20
|
-
function isParameterObject(obj) {
|
|
21
|
-
return obj && "in" in obj;
|
|
22
|
-
}
|
|
23
|
-
function isReference(obj) {
|
|
24
|
-
return !!obj && isRef(obj);
|
|
25
|
-
}
|
|
26
|
-
function isRequired(schema) {
|
|
27
|
-
if (!schema) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
return Array.isArray(schema.required) ? !!schema.required?.length : !!schema.required;
|
|
31
|
-
}
|
|
32
|
-
function isOptional(schema) {
|
|
33
|
-
return !isRequired(schema);
|
|
34
|
-
}
|
|
35
|
-
async function filterAndSort(data, options = {}) {
|
|
36
|
-
const mergedOptions = {
|
|
37
|
-
sort: options.sort ?? true,
|
|
38
|
-
["no-sort"]: options["no-sort"] ?? false,
|
|
39
|
-
sortSet: {
|
|
40
|
-
root: ["openapi", "info", "servers", "paths", "components", "tags", "x-tagGroups", "externalDocs"],
|
|
41
|
-
get: ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
|
|
42
|
-
post: ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
|
|
43
|
-
put: ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
|
|
44
|
-
patch: ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
|
|
45
|
-
delete: ["operationId", "summary", "description", "parameters", "requestBody", "responses"],
|
|
46
|
-
parameters: ["name", "in", "description", "required", "schema"],
|
|
47
|
-
requestBody: ["description", "required", "content"],
|
|
48
|
-
responses: ["description", "headers", "content", "links"],
|
|
49
|
-
content: [],
|
|
50
|
-
components: ["parameters", "schemas"],
|
|
51
|
-
schema: ["description", "type", "items", "properties", "format", "example", "default"],
|
|
52
|
-
schemas: ["description", "type", "items", "properties", "format", "example", "default"],
|
|
53
|
-
properties: ["description", "type", "items", "format", "example", "default", "enum"],
|
|
54
|
-
...options.sortSet
|
|
55
|
-
},
|
|
56
|
-
sortComponentsSet: {
|
|
57
|
-
...options.sortComponentsSet
|
|
58
|
-
},
|
|
59
|
-
filterSet: {
|
|
60
|
-
inverseMethods: ["get", "put", "post", "delete", "patch", "head", "options", "trace", "parameters"],
|
|
61
|
-
unusedComponents: options.filterSet ? ["requestBodies", "schemas", "parameters", "responses"] : [],
|
|
62
|
-
...options.filterSet
|
|
63
|
-
},
|
|
64
|
-
casingSet: {
|
|
65
|
-
...options.casingSet
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const restFilter = await openapiFormat.openapiFilter(data, mergedOptions);
|
|
69
|
-
data = restFilter.data;
|
|
70
|
-
const resFormat = await openapiFormat.openapiSort(data, mergedOptions);
|
|
71
|
-
data = resFormat.data;
|
|
72
|
-
const resChangeCase = await openapiFormat.openapiChangeCase(data, mergedOptions);
|
|
73
|
-
data = resChangeCase.data;
|
|
74
|
-
return data;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// src/Oas.ts
|
|
78
|
-
import BaseOas from "oas";
|
|
79
|
-
import OASNormalize from "oas-normalize";
|
|
80
|
-
import { findSchemaDefinition, matchesMimeType } from "oas/utils";
|
|
81
|
-
var _options, _Oas_instances, getResponseBodyFactory_fn;
|
|
82
|
-
var Oas = class extends BaseOas {
|
|
83
|
-
constructor({ oas, user }, options = {}) {
|
|
84
|
-
if (typeof oas === "string") {
|
|
85
|
-
oas = JSON.parse(oas);
|
|
86
|
-
}
|
|
87
|
-
super(oas, user);
|
|
88
|
-
__privateAdd(this, _Oas_instances);
|
|
89
|
-
__privateAdd(this, _options, {});
|
|
90
|
-
this.document = void 0;
|
|
91
|
-
this.document = oas;
|
|
92
|
-
__privateSet(this, _options, options);
|
|
93
|
-
}
|
|
94
|
-
dereferenceWithRef(schema) {
|
|
95
|
-
if (isReference(schema)) {
|
|
96
|
-
return {
|
|
97
|
-
...findSchemaDefinition(schema.$ref, this.api),
|
|
98
|
-
$ref: schema.$ref
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
return schema;
|
|
102
|
-
}
|
|
103
|
-
getResponseSchema(operation, statusCode) {
|
|
104
|
-
if (operation.schema.responses) {
|
|
105
|
-
Object.keys(operation.schema.responses).forEach((key) => {
|
|
106
|
-
const schema2 = operation.schema.responses[key];
|
|
107
|
-
const $ref = isReference(schema2) ? schema2.$ref : void 0;
|
|
108
|
-
if (schema2 && $ref) {
|
|
109
|
-
operation.schema.responses[key] = findSchemaDefinition($ref, this.api);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
const getResponseBody = __privateMethod(this, _Oas_instances, getResponseBodyFactory_fn).call(this, operation.getResponseByStatusCode(statusCode));
|
|
114
|
-
const { contentType } = __privateGet(this, _options);
|
|
115
|
-
const responseBody = getResponseBody(contentType);
|
|
116
|
-
if (responseBody === false) {
|
|
117
|
-
return {};
|
|
118
|
-
}
|
|
119
|
-
const schema = Array.isArray(responseBody) ? responseBody[1].schema : responseBody.schema;
|
|
120
|
-
if (!schema) {
|
|
121
|
-
return {};
|
|
122
|
-
}
|
|
123
|
-
return this.dereferenceWithRef(schema);
|
|
124
|
-
}
|
|
125
|
-
getRequestSchema(operation) {
|
|
126
|
-
const { contentType } = __privateGet(this, _options);
|
|
127
|
-
if (operation.schema.requestBody) {
|
|
128
|
-
operation.schema.requestBody = this.dereferenceWithRef(operation.schema.requestBody);
|
|
129
|
-
}
|
|
130
|
-
const requestBody = operation.getRequestBody(contentType);
|
|
131
|
-
if (requestBody === false) {
|
|
132
|
-
return void 0;
|
|
133
|
-
}
|
|
134
|
-
const schema = Array.isArray(requestBody) ? requestBody[1].schema : requestBody.schema;
|
|
135
|
-
if (!schema) {
|
|
136
|
-
return void 0;
|
|
137
|
-
}
|
|
138
|
-
return this.dereferenceWithRef(schema);
|
|
139
|
-
}
|
|
140
|
-
getParametersSchema(operation, inKey) {
|
|
141
|
-
const { contentType = operation.getContentType() } = __privateGet(this, _options);
|
|
142
|
-
const params = operation.getParameters().map((schema) => {
|
|
143
|
-
return this.dereferenceWithRef(schema);
|
|
144
|
-
}).filter((v) => v.in === inKey);
|
|
145
|
-
if (!params.length) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
return params.reduce(
|
|
149
|
-
(schema, pathParameters) => {
|
|
150
|
-
const property = pathParameters.content?.[contentType]?.schema ?? pathParameters.schema;
|
|
151
|
-
const required = [...schema.required || [], pathParameters.required ? pathParameters.name : void 0].filter(Boolean);
|
|
152
|
-
return {
|
|
153
|
-
...schema,
|
|
154
|
-
description: schema.description,
|
|
155
|
-
deprecated: schema.deprecated,
|
|
156
|
-
example: schema.example,
|
|
157
|
-
required,
|
|
158
|
-
properties: {
|
|
159
|
-
...schema.properties,
|
|
160
|
-
[pathParameters.name]: {
|
|
161
|
-
description: pathParameters.description,
|
|
162
|
-
...property
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
},
|
|
167
|
-
{ type: "object", required: [], properties: {} }
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
async valdiate() {
|
|
171
|
-
const oasNormalize = new OASNormalize(this.api, {
|
|
172
|
-
enablePaths: true,
|
|
173
|
-
colorizeErrors: true
|
|
174
|
-
});
|
|
175
|
-
await oasNormalize.validate({
|
|
176
|
-
parser: {
|
|
177
|
-
validate: {
|
|
178
|
-
colorizeErrors: true,
|
|
179
|
-
schema: false,
|
|
180
|
-
spec: false
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
_options = new WeakMap();
|
|
187
|
-
_Oas_instances = new WeakSet();
|
|
188
|
-
/**
|
|
189
|
-
* Oas does not have a getResponseBody(contentType)
|
|
190
|
-
*/
|
|
191
|
-
getResponseBodyFactory_fn = function(responseBody) {
|
|
192
|
-
function hasResponseBody(res = responseBody) {
|
|
193
|
-
return !!res;
|
|
194
|
-
}
|
|
195
|
-
return (contentType) => {
|
|
196
|
-
if (!hasResponseBody(responseBody)) {
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
if (isReference(responseBody)) {
|
|
200
|
-
return false;
|
|
201
|
-
}
|
|
202
|
-
if (!responseBody.content) {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
if (contentType) {
|
|
206
|
-
if (!(contentType in responseBody.content)) {
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
return responseBody.content[contentType];
|
|
210
|
-
}
|
|
211
|
-
let availablecontentType = void 0;
|
|
212
|
-
const contentTypes = Object.keys(responseBody.content);
|
|
213
|
-
contentTypes.forEach((mt) => {
|
|
214
|
-
if (!availablecontentType && matchesMimeType.json(mt)) {
|
|
215
|
-
availablecontentType = mt;
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
if (!availablecontentType) {
|
|
219
|
-
contentTypes.forEach((mt) => {
|
|
220
|
-
if (!availablecontentType) {
|
|
221
|
-
availablecontentType = mt;
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
if (availablecontentType) {
|
|
226
|
-
return [availablecontentType, responseBody.content[availablecontentType], ...responseBody.description ? [responseBody.description] : []];
|
|
227
|
-
}
|
|
228
|
-
return false;
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
export {
|
|
233
|
-
isOpenApiV2Document,
|
|
234
|
-
isOpenApiV3_1Document,
|
|
235
|
-
isParameterObject,
|
|
236
|
-
isReference,
|
|
237
|
-
isRequired,
|
|
238
|
-
isOptional,
|
|
239
|
-
filterAndSort,
|
|
240
|
-
Oas
|
|
241
|
-
};
|
|
242
|
-
//# sourceMappingURL=chunk-7D7ASOLY.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts","../src/Oas.ts"],"sourcesContent":["import { isRef, isSchema } from 'oas/types'\nimport openapiFormat from 'openapi-format'\nimport { isPlainObject } from 'remeda'\n\nimport type { OASDocument, ParameterObject, SchemaObject } from 'oas/types'\nimport type { OpenAPIV2, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types'\nimport type { FormatOptions } from './parser/index.ts'\n\nexport function isOpenApiV2Document(doc: any): doc is OpenAPIV2.Document {\n return doc && isPlainObject(doc) && !('openapi' in doc)\n}\nexport function isOpenApiV3Document(doc: any): doc is OpenAPIV3.Document {\n return doc && isPlainObject(doc) && 'openapi' in doc\n}\n\nexport function isOpenApiV3_1Document(doc: any): doc is OpenAPIV3_1.Document {\n return doc && isPlainObject<OpenAPIV3_1.Document>(doc) && 'openapi' in doc && doc.openapi.startsWith('3.1')\n}\n\nexport function isJSONSchema(obj?: unknown): obj is SchemaObject {\n return !!obj && isSchema(obj)\n}\n\nexport function isParameterObject(obj: ParameterObject | SchemaObject): obj is ParameterObject {\n return obj && 'in' in obj\n}\n\nexport function isReference(obj?: unknown): obj is OpenAPIV3.ReferenceObject | OpenAPIV3_1.ReferenceObject {\n return !!obj && isRef(obj)\n}\n\nexport function isRequired(schema?: SchemaObject): boolean {\n if (!schema) {\n return false\n }\n\n return Array.isArray(schema.required) ? !!schema.required?.length : !!schema.required\n}\n\nexport function isOptional(schema?: SchemaObject): boolean {\n return !isRequired(schema)\n}\n\nexport async function filterAndSort(data: OASDocument, options: FormatOptions = {}): Promise<OASDocument> {\n const mergedOptions: FormatOptions = {\n sort: options.sort ?? true,\n ['no-sort']: options['no-sort'] ?? false,\n sortSet: {\n root: ['openapi', 'info', 'servers', 'paths', 'components', 'tags', 'x-tagGroups', 'externalDocs'],\n get: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],\n post: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],\n put: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],\n patch: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],\n delete: ['operationId', 'summary', 'description', 'parameters', 'requestBody', 'responses'],\n parameters: ['name', 'in', 'description', 'required', 'schema'],\n requestBody: ['description', 'required', 'content'],\n responses: ['description', 'headers', 'content', 'links'],\n content: [],\n components: ['parameters', 'schemas'],\n schema: ['description', 'type', 'items', 'properties', 'format', 'example', 'default'],\n schemas: ['description', 'type', 'items', 'properties', 'format', 'example', 'default'],\n properties: ['description', 'type', 'items', 'format', 'example', 'default', 'enum'],\n ...options.sortSet,\n },\n sortComponentsSet: {\n ...options.sortComponentsSet,\n },\n filterSet: {\n inverseMethods: ['get', 'put', 'post', 'delete', 'patch', 'head', 'options', 'trace', 'parameters'],\n unusedComponents: options.filterSet ? ['requestBodies', 'schemas', 'parameters', 'responses'] : [],\n ...options.filterSet,\n },\n casingSet: {\n ...options.casingSet,\n },\n }\n\n const restFilter = await openapiFormat.openapiFilter(data, mergedOptions)\n data = restFilter.data\n\n const resFormat = await openapiFormat.openapiSort(data, mergedOptions)\n data = resFormat.data\n\n const resChangeCase = await openapiFormat.openapiChangeCase(data, mergedOptions)\n data = resChangeCase.data\n\n return data\n}\n","import BaseOas from 'oas'\nimport OASNormalize from 'oas-normalize'\nimport { findSchemaDefinition, matchesMimeType } from 'oas/utils'\n\nimport { isReference } from './utils.ts'\n\nimport type { Operation } from 'oas/operation'\nimport type { MediaTypeObject, OASDocument, ResponseObject, SchemaObject, User } from 'oas/types'\nimport type { contentType } from './types.ts'\n\ntype Options = {\n contentType?: contentType\n}\n\nexport class Oas<const TOAS = unknown> extends BaseOas {\n #options: Options = {}\n document: TOAS = undefined as unknown as TOAS\n\n constructor({ oas, user }: { oas: TOAS | OASDocument | string; user?: User }, options: Options = {}) {\n if (typeof oas === 'string') {\n oas = JSON.parse(oas)\n }\n\n super(oas as OASDocument, user)\n\n this.document = oas as TOAS\n this.#options = options\n }\n\n dereferenceWithRef(schema?: unknown) {\n if (isReference(schema)) {\n return {\n ...findSchemaDefinition(schema.$ref, this.api),\n $ref: schema.$ref,\n }\n }\n\n return schema\n }\n\n /**\n * Oas does not have a getResponseBody(contentType)\n */\n #getResponseBodyFactory(responseBody: boolean | ResponseObject): (contentType?: string) => MediaTypeObject | false | [string, MediaTypeObject, ...string[]] {\n function hasResponseBody(res = responseBody): res is ResponseObject {\n return !!res\n }\n\n return (contentType) => {\n if (!hasResponseBody(responseBody)) {\n return false\n }\n\n if (isReference(responseBody)) {\n // If the request body is still a `$ref` pointer we should return false because this library\n // assumes that you've run dereferencing beforehand.\n return false\n }\n\n if (!responseBody.content) {\n return false\n }\n\n if (contentType) {\n if (!(contentType in responseBody.content)) {\n return false\n }\n\n return responseBody.content[contentType]!\n }\n\n // Since no media type was supplied we need to find either the first JSON-like media type that\n // we've got, or the first available of anything else if no JSON-like media types are present.\n let availablecontentType: string | undefined = undefined\n const contentTypes = Object.keys(responseBody.content)\n contentTypes.forEach((mt: string) => {\n if (!availablecontentType && matchesMimeType.json(mt)) {\n availablecontentType = mt\n }\n })\n\n if (!availablecontentType) {\n contentTypes.forEach((mt: string) => {\n if (!availablecontentType) {\n availablecontentType = mt\n }\n })\n }\n\n if (availablecontentType) {\n return [availablecontentType, responseBody.content[availablecontentType]!, ...(responseBody.description ? [responseBody.description] : [])]\n }\n\n return false\n }\n }\n\n getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject {\n if (operation.schema.responses) {\n Object.keys(operation.schema.responses).forEach((key) => {\n const schema = operation.schema.responses![key]\n const $ref = isReference(schema) ? schema.$ref : undefined\n\n if (schema && $ref) {\n operation.schema.responses![key] = findSchemaDefinition($ref, this.api)\n }\n })\n }\n\n const getResponseBody = this.#getResponseBodyFactory(operation.getResponseByStatusCode(statusCode))\n\n const { contentType } = this.#options\n const responseBody = getResponseBody(contentType)\n\n if (responseBody === false) {\n // return empty object because response will always be defined(request does not need a body)\n return {}\n }\n\n const schema = Array.isArray(responseBody) ? responseBody[1].schema : responseBody.schema\n\n if (!schema) {\n // return empty object because response will always be defined(request does not need a body)\n\n return {}\n }\n\n return this.dereferenceWithRef(schema)\n }\n\n getRequestSchema(operation: Operation): SchemaObject | undefined {\n const { contentType } = this.#options\n\n if (operation.schema.requestBody) {\n operation.schema.requestBody = this.dereferenceWithRef(operation.schema.requestBody)\n }\n\n const requestBody = operation.getRequestBody(contentType)\n\n if (requestBody === false) {\n return undefined\n }\n\n const schema = Array.isArray(requestBody) ? requestBody[1].schema : requestBody.schema\n\n if (!schema) {\n return undefined\n }\n\n return this.dereferenceWithRef(schema)\n }\n\n getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null {\n const { contentType = operation.getContentType() } = this.#options\n const params = operation\n .getParameters()\n .map((schema) => {\n return this.dereferenceWithRef(schema)\n })\n .filter((v) => v.in === inKey)\n\n if (!params.length) {\n return null\n }\n\n return params.reduce(\n (schema, pathParameters) => {\n const property = pathParameters.content?.[contentType]?.schema ?? (pathParameters.schema as SchemaObject)\n const required = [...(schema.required || ([] as any)), pathParameters.required ? pathParameters.name : undefined].filter(Boolean)\n\n return {\n ...schema,\n description: schema.description,\n deprecated: schema.deprecated,\n example: schema.example,\n required,\n properties: {\n ...schema.properties,\n [pathParameters.name]: {\n description: pathParameters.description,\n ...property,\n },\n },\n }\n },\n { type: 'object', required: [], properties: {} } as SchemaObject,\n )\n }\n\n async valdiate() {\n const oasNormalize = new OASNormalize(this.api, {\n enablePaths: true,\n colorizeErrors: true,\n })\n\n await oasNormalize.validate({\n parser: {\n validate: {\n colorizeErrors: true,\n schema: false,\n spec: false,\n },\n },\n })\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,OAAO,gBAAgB;AAChC,OAAO,mBAAmB;AAC1B,SAAS,qBAAqB;AAMvB,SAAS,oBAAoB,KAAqC;AACvE,SAAO,OAAO,cAAc,GAAG,KAAK,EAAE,aAAa;AACrD;AAKO,SAAS,sBAAsB,KAA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