@kubb/oas 2.13.3 → 2.14.0
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/dist/parser.cjs +6 -1
- package/dist/parser.cjs.map +1 -1
- package/dist/parser.d.cts +2 -2
- package/dist/parser.d.ts +2 -2
- package/dist/parser.js +6 -1
- package/dist/parser.js.map +1 -1
- package/package.json +3 -3
- package/src/parser/index.ts +12 -5
package/dist/parser.cjs
CHANGED
|
@@ -11,7 +11,12 @@ async function parse(pathOrApi) {
|
|
|
11
11
|
enablePaths: true,
|
|
12
12
|
colorizeErrors: true
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
let document;
|
|
15
|
+
try {
|
|
16
|
+
document = await oasNormalize.bundle();
|
|
17
|
+
} catch (e) {
|
|
18
|
+
document = await oasNormalize.load();
|
|
19
|
+
}
|
|
15
20
|
if (_chunkEPQ73VUMcjs.isOpenApiV2Document.call(void 0, document)) {
|
|
16
21
|
const { openapi: oas } = await _swagger2openapi2.default.convertObj(document, { anchors: true });
|
|
17
22
|
return new (0, _chunkEPQ73VUMcjs.Oas)({ oas });
|
package/dist/parser.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/parser/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB;AACzB,OAAO,qBAAqB;
|
|
1
|
+
{"version":3,"sources":["../src/parser/index.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,kBAAkB;AACzB,OAAO,qBAAqB;AAQ5B,eAAsB,MAAM,WAA+C;AACzE,QAAM,eAAe,IAAI,aAAa,WAAW;AAAA,IAC/C,aAAa;AAAA,IACb,gBAAgB;AAAA,EAClB,CAAC;AACD,MAAI;AAEJ,MAAI;AAEF,eAAW,MAAM,aAAa,OAAO;AAAA,EACvC,SAAS,GAAG;AACV,eAAY,MAAM,aAAa,KAAK;AAAA,EACtC;AAEA,MAAI,oBAAoB,QAAQ,GAAG;AACjC,UAAM,EAAE,SAAS,IAAI,IAAI,MAAM,gBAAgB,WAAW,UAAU,EAAE,SAAS,KAAK,CAAC;AAErF,WAAO,IAAI,IAAI,EAAE,IAAwB,CAAC;AAAA,EAC5C;AAEA,SAAO,IAAI,IAAI,EAAE,KAAK,SAAS,CAAC;AAClC","sourcesContent":["import OASNormalize from 'oas-normalize'\nimport swagger2openapi from 'swagger2openapi'\n\nimport { Oas } from '../Oas.ts'\nimport { isOpenApiV2Document } from '../utils.ts'\n\nimport type { OASDocument } from 'oas/types'\nimport type { OpenAPI } from 'openapi-types'\n\nexport async function parse(pathOrApi: string | OASDocument): Promise<Oas> {\n const oasNormalize = new OASNormalize(pathOrApi, {\n enablePaths: true,\n colorizeErrors: true,\n })\n let document: OpenAPI.Document\n\n try {\n // resolve external refs\n document = await oasNormalize.bundle()\n } catch (e) {\n document = (await oasNormalize.load()) as OpenAPI.Document\n }\n\n if (isOpenApiV2Document(document)) {\n const { openapi: oas } = await swagger2openapi.convertObj(document, { anchors: true })\n\n return new Oas({ oas: oas as OASDocument })\n }\n\n return new Oas({ oas: document })\n}\n"]}
|
package/dist/parser.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { O as Oas } from './Oas-BEe7KZDj.cjs';
|
|
2
|
-
import
|
|
2
|
+
import { OASDocument } from 'oas/types';
|
|
3
3
|
import 'oas';
|
|
4
4
|
import 'oas/operation';
|
|
5
5
|
|
|
6
|
-
declare function parse(pathOrApi: string |
|
|
6
|
+
declare function parse(pathOrApi: string | OASDocument): Promise<Oas>;
|
|
7
7
|
|
|
8
8
|
export { parse };
|
package/dist/parser.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { O as Oas } from './Oas-BEe7KZDj.js';
|
|
2
|
-
import
|
|
2
|
+
import { OASDocument } from 'oas/types';
|
|
3
3
|
import 'oas';
|
|
4
4
|
import 'oas/operation';
|
|
5
5
|
|
|
6
|
-
declare function parse(pathOrApi: string |
|
|
6
|
+
declare function parse(pathOrApi: string | OASDocument): Promise<Oas>;
|
|
7
7
|
|
|
8
8
|
export { parse };
|
package/dist/parser.js
CHANGED
|
@@ -11,7 +11,12 @@ async function parse(pathOrApi) {
|
|
|
11
11
|
enablePaths: true,
|
|
12
12
|
colorizeErrors: true
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
let document;
|
|
15
|
+
try {
|
|
16
|
+
document = await oasNormalize.bundle();
|
|
17
|
+
} catch (e) {
|
|
18
|
+
document = await oasNormalize.load();
|
|
19
|
+
}
|
|
15
20
|
if (isOpenApiV2Document(document)) {
|
|
16
21
|
const { openapi: oas } = await swagger2openapi.convertObj(document, { anchors: true });
|
|
17
22
|
return new Oas({ oas });
|
package/dist/parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/parser/index.ts"],"sourcesContent":["import OASNormalize from 'oas-normalize'\nimport swagger2openapi from 'swagger2openapi'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../src/parser/index.ts"],"sourcesContent":["import OASNormalize from 'oas-normalize'\nimport swagger2openapi from 'swagger2openapi'\n\nimport { Oas } from '../Oas.ts'\nimport { isOpenApiV2Document } from '../utils.ts'\n\nimport type { OASDocument } from 'oas/types'\nimport type { OpenAPI } from 'openapi-types'\n\nexport async function parse(pathOrApi: string | OASDocument): Promise<Oas> {\n const oasNormalize = new OASNormalize(pathOrApi, {\n enablePaths: true,\n colorizeErrors: true,\n })\n let document: OpenAPI.Document\n\n try {\n // resolve external refs\n document = await oasNormalize.bundle()\n } catch (e) {\n document = (await oasNormalize.load()) as OpenAPI.Document\n }\n\n if (isOpenApiV2Document(document)) {\n const { openapi: oas } = await swagger2openapi.convertObj(document, { anchors: true })\n\n return new Oas({ oas: oas as OASDocument })\n }\n\n return new Oas({ oas: document })\n}\n"],"mappings":";;;;;;AAAA,OAAO,kBAAkB;AACzB,OAAO,qBAAqB;AAQ5B,eAAsB,MAAM,WAA+C;AACzE,QAAM,eAAe,IAAI,aAAa,WAAW;AAAA,IAC/C,aAAa;AAAA,IACb,gBAAgB;AAAA,EAClB,CAAC;AACD,MAAI;AAEJ,MAAI;AAEF,eAAW,MAAM,aAAa,OAAO;AAAA,EACvC,SAAS,GAAG;AACV,eAAY,MAAM,aAAa,KAAK;AAAA,EACtC;AAEA,MAAI,oBAAoB,QAAQ,GAAG;AACjC,UAAM,EAAE,SAAS,IAAI,IAAI,MAAM,gBAAgB,WAAW,UAAU,EAAE,SAAS,KAAK,CAAC;AAErF,WAAO,IAAI,IAAI,EAAE,IAAwB,CAAC;AAAA,EAC5C;AAEA,SAAO,IAAI,IAAI,EAAE,KAAK,SAAS,CAAC;AAClC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/oas",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "Oas helpers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"!/**/__tests__/**"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
+
"hotscript": "^1.0.13",
|
|
52
|
+
"json-schema-to-ts": "^3.0.1",
|
|
51
53
|
"oas": "^24.2.2",
|
|
52
54
|
"oas-normalize": "^11.0.4",
|
|
53
55
|
"openapi-types": "^12.1.3",
|
|
54
56
|
"remeda": "^1.61.0",
|
|
55
57
|
"swagger2openapi": "^7.0.8",
|
|
56
|
-
"hotscript": "^1.0.13",
|
|
57
|
-
"json-schema-to-ts": "^3.0.1",
|
|
58
58
|
"ts-toolbelt": "^9.6.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
package/src/parser/index.ts
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import OASNormalize from 'oas-normalize'
|
|
2
2
|
import swagger2openapi from 'swagger2openapi'
|
|
3
3
|
|
|
4
|
-
import type { OpenAPIV2 } from 'openapi-types'
|
|
5
4
|
import { Oas } from '../Oas.ts'
|
|
6
|
-
import type { OasTypes } from '../types.ts'
|
|
7
5
|
import { isOpenApiV2Document } from '../utils.ts'
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
import type { OASDocument } from 'oas/types'
|
|
8
|
+
import type { OpenAPI } from 'openapi-types'
|
|
9
|
+
|
|
10
|
+
export async function parse(pathOrApi: string | OASDocument): Promise<Oas> {
|
|
10
11
|
const oasNormalize = new OASNormalize(pathOrApi, {
|
|
11
12
|
enablePaths: true,
|
|
12
13
|
colorizeErrors: true,
|
|
13
14
|
})
|
|
15
|
+
let document: OpenAPI.Document
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
try {
|
|
18
|
+
// resolve external refs
|
|
19
|
+
document = await oasNormalize.bundle()
|
|
20
|
+
} catch (e) {
|
|
21
|
+
document = (await oasNormalize.load()) as OpenAPI.Document
|
|
22
|
+
}
|
|
16
23
|
|
|
17
24
|
if (isOpenApiV2Document(document)) {
|
|
18
25
|
const { openapi: oas } = await swagger2openapi.convertObj(document, { anchors: true })
|
|
19
26
|
|
|
20
|
-
return new Oas({ oas: oas as
|
|
27
|
+
return new Oas({ oas: oas as OASDocument })
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
return new Oas({ oas: document })
|