@kubb/plugin-oas 4.20.0 → 4.20.2
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/{SchemaGenerator-CK_Mv0RW.js → SchemaGenerator-B3d6gOW8.js} +39 -11
- package/dist/SchemaGenerator-B3d6gOW8.js.map +1 -0
- package/dist/{SchemaGenerator-D2ZpjZgn.cjs → SchemaGenerator-m8ILeAM0.cjs} +44 -10
- package/dist/SchemaGenerator-m8ILeAM0.cjs.map +1 -0
- package/dist/{SchemaMapper-DI2vHHE0.d.ts → SchemaMapper-DnWpiVfW.d.ts} +1 -1
- package/dist/{createGenerator-b8YXprrE.d.ts → createGenerator-D30QUDWi.d.ts} +2 -2
- package/dist/{generators-DoPBikIW.js → generators-C86kmpzf.js} +2 -2
- package/dist/{generators-DoPBikIW.js.map → generators-C86kmpzf.js.map} +1 -1
- package/dist/{generators-OR75jnZv.cjs → generators-DlQEksu_.cjs} +2 -2
- package/dist/{generators-OR75jnZv.cjs.map → generators-DlQEksu_.cjs.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +2 -2
- package/dist/generators.js +1 -1
- package/dist/{getFooter-BvLkEWpc.cjs → getFooter-C_dFbEs9.cjs} +1 -1
- package/dist/{getFooter-BvLkEWpc.cjs.map → getFooter-C_dFbEs9.cjs.map} +1 -1
- package/dist/{getFooter-PYWvz29J.js → getFooter-flVUU6wg.js} +1 -1
- package/dist/{getFooter-PYWvz29J.js.map → getFooter-flVUU6wg.js.map} +1 -1
- package/dist/hooks.cjs +1 -13
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +1 -2
- package/dist/hooks.d.ts +2 -3
- package/dist/hooks.js +1 -13
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/mocks.d.ts +1 -1
- package/dist/utils.cjs +23 -5
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +9 -2
- package/dist/utils.d.ts +10 -3
- package/dist/utils.js +23 -5
- package/dist/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/hooks/useSchemaManager.ts +0 -21
- package/src/utils/getComments.ts +5 -2
- package/src/utils/getImports.ts +24 -0
- package/src/utils/index.ts +1 -0
- package/dist/SchemaGenerator-CK_Mv0RW.js.map +0 -1
- package/dist/SchemaGenerator-D2ZpjZgn.cjs.map +0 -1
- package/dist/getSchemaFactory-CBp1me72.cjs +0 -29
- package/dist/getSchemaFactory-CBp1me72.cjs.map +0 -1
- package/dist/getSchemaFactory-DsoVRgxV.js +0 -24
- package/dist/getSchemaFactory-DsoVRgxV.js.map +0 -1
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-C1_xRkKa.cjs');
|
|
2
|
-
let _kubb_oas = require("@kubb/oas");
|
|
3
|
-
|
|
4
|
-
//#region src/utils/getSchemaFactory.ts
|
|
5
|
-
/**
|
|
6
|
-
* Creates a factory function that generates a versioned OpenAPI schema result.
|
|
7
|
-
*
|
|
8
|
-
* The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1').
|
|
9
|
-
*
|
|
10
|
-
* @returns A function that takes an optional schema and returns a versioned schema result.
|
|
11
|
-
*/
|
|
12
|
-
function getSchemaFactory(oas) {
|
|
13
|
-
return (schema) => {
|
|
14
|
-
const version = (0, _kubb_oas.isOpenApiV3_1Document)(oas.api) ? "3.1" : "3.0";
|
|
15
|
-
return {
|
|
16
|
-
schemaObject: oas.dereferenceWithRef(schema),
|
|
17
|
-
version
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
Object.defineProperty(exports, 'getSchemaFactory', {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () {
|
|
26
|
-
return getSchemaFactory;
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
//# sourceMappingURL=getSchemaFactory-CBp1me72.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSchemaFactory-CBp1me72.cjs","names":[],"sources":["../src/utils/getSchemaFactory.ts"],"sourcesContent":["import type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\nimport { isOpenApiV3_1Document } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schemaObject:\n | ((TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n })\n | null\n version: '3.0'\n }\n | {\n schemaObject:\n | ((TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n })\n | null\n version: '3.1'\n }\n\n/**\n * Creates a factory function that generates a versioned OpenAPI schema result.\n *\n * The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1').\n *\n * @returns A function that takes an optional schema and returns a versioned schema result.\n */\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema: SchemaObject | null) => SchemaResult<TWithRef> {\n return (schema: SchemaObject | null) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schemaObject: oas.dereferenceWithRef(schema),\n version,\n } as SchemaResult<TWithRef>\n }\n}\n"],"mappings":";;;;;;;;;;;AAiCA,SAAgB,iBAAmD,KAAmE;AACpI,SAAQ,WAAgC;EACtC,MAAM,+CAAgC,IAAI,IAAI,GAAG,QAAQ;AAEzD,SAAO;GACL,cAAc,IAAI,mBAAmB,OAAO;GAC5C;GACD"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-iVr_oF3V.js";
|
|
2
|
-
import { isOpenApiV3_1Document } from "@kubb/oas";
|
|
3
|
-
|
|
4
|
-
//#region src/utils/getSchemaFactory.ts
|
|
5
|
-
/**
|
|
6
|
-
* Creates a factory function that generates a versioned OpenAPI schema result.
|
|
7
|
-
*
|
|
8
|
-
* The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1').
|
|
9
|
-
*
|
|
10
|
-
* @returns A function that takes an optional schema and returns a versioned schema result.
|
|
11
|
-
*/
|
|
12
|
-
function getSchemaFactory(oas) {
|
|
13
|
-
return (schema) => {
|
|
14
|
-
const version = isOpenApiV3_1Document(oas.api) ? "3.1" : "3.0";
|
|
15
|
-
return {
|
|
16
|
-
schemaObject: oas.dereferenceWithRef(schema),
|
|
17
|
-
version
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
export { getSchemaFactory as t };
|
|
24
|
-
//# sourceMappingURL=getSchemaFactory-DsoVRgxV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSchemaFactory-DsoVRgxV.js","names":[],"sources":["../src/utils/getSchemaFactory.ts"],"sourcesContent":["import type { Oas, OpenAPIV3, OpenAPIV3_1, SchemaObject } from '@kubb/oas'\nimport { isOpenApiV3_1Document } from '@kubb/oas'\n\n/**\n * Make it possible to narrow down the schema based on a specific version(3 or 3.1)\n */\ntype SchemaResult<TWithRef extends boolean = false> =\n | {\n schemaObject:\n | ((TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n })\n | null\n version: '3.0'\n }\n | {\n schemaObject:\n | ((TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {\n nullable?: boolean\n 'x-nullable'?: boolean\n })\n | null\n version: '3.1'\n }\n\n/**\n * Creates a factory function that generates a versioned OpenAPI schema result.\n *\n * The returned function accepts an optional schema object and produces a {@link SchemaResult} containing the dereferenced schema and the OpenAPI version ('3.0' or '3.1').\n *\n * @returns A function that takes an optional schema and returns a versioned schema result.\n */\nexport function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema: SchemaObject | null) => SchemaResult<TWithRef> {\n return (schema: SchemaObject | null) => {\n const version = isOpenApiV3_1Document(oas.api) ? '3.1' : '3.0'\n\n return {\n schemaObject: oas.dereferenceWithRef(schema),\n version,\n } as SchemaResult<TWithRef>\n }\n}\n"],"mappings":";;;;;;;;;;;AAiCA,SAAgB,iBAAmD,KAAmE;AACpI,SAAQ,WAAgC;EACtC,MAAM,UAAU,sBAAsB,IAAI,IAAI,GAAG,QAAQ;AAEzD,SAAO;GACL,cAAc,IAAI,mBAAmB,OAAO;GAC5C;GACD"}
|