@kubb/plugin-oas 0.0.0-canary-20251222105814 → 0.0.0-canary-20251222160843
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-CMTHp8Vr.cjs → SchemaGenerator-DTyNa5fQ.cjs} +61 -50
- package/dist/SchemaGenerator-DTyNa5fQ.cjs.map +1 -0
- package/dist/{SchemaGenerator-C3pXVNT4.js → SchemaGenerator-DZHRBTyZ.js} +61 -50
- package/dist/SchemaGenerator-DZHRBTyZ.js.map +1 -0
- package/dist/SchemaMapper-BN2pgCUs.cjs.map +1 -1
- package/dist/{SchemaMapper-DAG4v9p9.d.cts → SchemaMapper-BQqC-HKo.d.ts} +23 -24
- package/dist/{SchemaMapper-yut6dpX_.d.ts → SchemaMapper-DHoFzVaG.d.cts} +23 -24
- package/dist/SchemaMapper-eCHsqfmg.js.map +1 -1
- package/dist/{createGenerator-DUHS_zue.d.cts → createGenerator-BOeO1z4V.d.cts} +6 -6
- package/dist/{createGenerator-DTPF3u5a.d.ts → createGenerator-BPhjS5cM.d.ts} +6 -6
- package/dist/generators.d.cts +2 -2
- package/dist/generators.d.ts +2 -2
- package/dist/getSchemas-DFlFfjx-.cjs.map +1 -1
- package/dist/getSchemas-DH7Mz7ud.js.map +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.d.cts +2 -2
- package/dist/hooks.d.ts +2 -2
- package/dist/hooks.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/mocks.d.cts +1 -1
- package/dist/mocks.d.ts +1 -1
- package/dist/utils.d.cts +7 -7
- package/dist/utils.d.ts +7 -7
- package/package.json +3 -3
- package/src/SchemaGenerator.ts +88 -47
- package/src/SchemaMapper.ts +1 -0
- package/src/utils/getSchemaFactory.ts +14 -10
- package/dist/SchemaGenerator-C3pXVNT4.js.map +0 -1
- package/dist/SchemaGenerator-CMTHp8Vr.cjs.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
2
1
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
|
-
import
|
|
4
|
-
import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
|
|
5
|
-
import { Operation, Operation as Operation$1 } from "oas/operation";
|
|
6
|
-
import { OpenAPIV3, OpenAPIV3 as OpenAPIV3$1, OpenAPIV3_1 } from "openapi-types";
|
|
2
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
7
3
|
import * as oas_normalize_lib_types0 from "oas-normalize/lib/types";
|
|
8
4
|
import BaseOas from "oas";
|
|
5
|
+
import { Operation } from "oas/operation";
|
|
6
|
+
import { OpenAPIV3, OpenAPIV3_1 } from "openapi-types";
|
|
7
|
+
import * as OasTypes from "oas/types";
|
|
8
|
+
import { DiscriminatorObject, HttpMethods, OASDocument, SchemaObject } from "oas/types";
|
|
9
9
|
|
|
10
10
|
//#region ../core/src/BaseGenerator.d.ts
|
|
11
11
|
/**
|
|
@@ -676,38 +676,36 @@ type FileMetaBase = {
|
|
|
676
676
|
//#endregion
|
|
677
677
|
//#region ../oas/src/types.d.ts
|
|
678
678
|
type contentType = 'application/json' | (string & {});
|
|
679
|
-
type SchemaObject$1 =
|
|
679
|
+
type SchemaObject$1 = SchemaObject & {
|
|
680
680
|
'x-nullable'?: boolean;
|
|
681
681
|
$ref?: string;
|
|
682
682
|
};
|
|
683
|
+
type HttpMethod = HttpMethods;
|
|
684
|
+
type Document = OASDocument;
|
|
685
|
+
type Operation$1 = Operation;
|
|
686
|
+
type DiscriminatorObject$1 = DiscriminatorObject;
|
|
683
687
|
//#endregion
|
|
684
688
|
//#region ../oas/src/Oas.d.ts
|
|
685
689
|
type Options = {
|
|
686
690
|
contentType?: contentType;
|
|
687
691
|
discriminator?: 'strict' | 'inherit';
|
|
688
692
|
};
|
|
689
|
-
declare class Oas
|
|
693
|
+
declare class Oas extends BaseOas {
|
|
690
694
|
#private;
|
|
691
|
-
document:
|
|
692
|
-
constructor(
|
|
693
|
-
oas,
|
|
694
|
-
user
|
|
695
|
-
}: {
|
|
696
|
-
oas: TOAS | OASDocument | string;
|
|
697
|
-
user?: User;
|
|
698
|
-
});
|
|
695
|
+
document: Document;
|
|
696
|
+
constructor(document: Document);
|
|
699
697
|
setOptions(options: Options): void;
|
|
700
698
|
get options(): Options;
|
|
701
|
-
get($ref: string):
|
|
699
|
+
get<T = unknown>($ref: string): T | null;
|
|
702
700
|
getKey($ref: string): string | undefined;
|
|
703
701
|
set($ref: string, value: unknown): false | undefined;
|
|
704
|
-
getDiscriminator(schema:
|
|
705
|
-
dereferenceWithRef(schema?:
|
|
706
|
-
getResponseSchema(operation: Operation, statusCode: string | number): SchemaObject;
|
|
707
|
-
getRequestSchema(operation: Operation): SchemaObject | undefined;
|
|
708
|
-
getParametersSchema(operation: Operation, inKey: 'path' | 'query' | 'header'): SchemaObject | null;
|
|
702
|
+
getDiscriminator(schema: SchemaObject$1 | null): DiscriminatorObject$1 | null;
|
|
703
|
+
dereferenceWithRef<T = unknown>(schema?: T): T;
|
|
704
|
+
getResponseSchema(operation: Operation$1, statusCode: string | number): SchemaObject$1;
|
|
705
|
+
getRequestSchema(operation: Operation$1): SchemaObject$1 | undefined;
|
|
706
|
+
getParametersSchema(operation: Operation$1, inKey: 'path' | 'query' | 'header'): SchemaObject$1 | null;
|
|
709
707
|
valdiate(): Promise<oas_normalize_lib_types0.ValidationResult>;
|
|
710
|
-
flattenSchema(schema
|
|
708
|
+
flattenSchema(schema: SchemaObject$1 | null): SchemaObject$1 | null;
|
|
711
709
|
}
|
|
712
710
|
//#endregion
|
|
713
711
|
//#region ../oas/src/utils.d.ts
|
|
@@ -722,6 +720,7 @@ type SchemaKeywordMapper = {
|
|
|
722
720
|
[x: string]: Schema[];
|
|
723
721
|
};
|
|
724
722
|
additionalProperties: Schema[];
|
|
723
|
+
patternProperties?: Record<string, Schema[]>;
|
|
725
724
|
strict?: boolean;
|
|
726
725
|
};
|
|
727
726
|
};
|
|
@@ -995,5 +994,5 @@ type SchemaTree = {
|
|
|
995
994
|
};
|
|
996
995
|
declare function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]>;
|
|
997
996
|
//#endregion
|
|
998
|
-
export { Plugin as C, AsyncEventEmitter as D, UserPluginWithLifeCycle as E, KubbEvents as O, Output as S, ResolveNameParams as T, contentType as _, SchemaMapper as a, Config as b, schemaKeywords as c, HttpMethod as d, OasTypes as f, SchemaObject$1 as g, Operation$1 as h, SchemaKeywordMapper as i, BaseGenerator as k, isOptional as l, OpenAPIV3_1 as m, SchemaKeyword as n, SchemaTree as o, OpenAPIV3
|
|
999
|
-
//# sourceMappingURL=SchemaMapper-
|
|
997
|
+
export { Plugin as C, AsyncEventEmitter as D, UserPluginWithLifeCycle as E, KubbEvents as O, Output as S, ResolveNameParams as T, contentType as _, SchemaMapper as a, Config as b, schemaKeywords as c, HttpMethod as d, OasTypes as f, SchemaObject$1 as g, Operation$1 as h, SchemaKeywordMapper as i, BaseGenerator as k, isOptional as l, OpenAPIV3_1 as m, SchemaKeyword as n, SchemaTree as o, OpenAPIV3 as p, SchemaKeywordBase as r, isKeyword as s, Schema as t, Oas as u, FileMetaBase as v, PluginFactoryOptions as w, Group as x, PluginManager as y };
|
|
998
|
+
//# sourceMappingURL=SchemaMapper-DHoFzVaG.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaMapper-eCHsqfmg.js","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport type { SchemaObject } from '@kubb/oas'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n strict?: boolean\n }\n }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n writeOnly: { keyword: 'writeOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number; rest?: Schema } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number; unique?: boolean }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: {\n name: string\n $ref: string\n /**\n * Full qualified path.\n */\n path: KubbFile.Path\n /**\n * When true `File.Import` will be used.\n * When false a reference will be used inside the current file.\n */\n isImportable: boolean\n }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n exclusiveMaximum: { keyword: 'exclusiveMaximum'; args: number }\n exclusiveMinimum: { keyword: 'exclusiveMinimum'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n void: { keyword: 'void' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n interface: { keyword: 'interface' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n void: 'void',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n exclusiveMinimum: 'exclusiveMinimum',\n exclusiveMaximum: 'exclusiveMaximum',\n optional: 'optional',\n readOnly: 'readOnly',\n writeOnly: 'writeOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n interface: 'interface',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport type SchemaTree = {\n schema: SchemaObject\n parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this will be equal to the key of a property(object)\n */\n name?: string\n}\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"SchemaMapper-eCHsqfmg.js","names":[],"sources":["../src/SchemaMapper.ts"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport type { SchemaObject } from '@kubb/oas'\n\nexport type SchemaKeywordMapper = {\n object: {\n keyword: 'object'\n args: {\n properties: { [x: string]: Schema[] }\n additionalProperties: Schema[]\n patternProperties?: Record<string, Schema[]>\n strict?: boolean\n }\n }\n url: { keyword: 'url' }\n readOnly: { keyword: 'readOnly' }\n writeOnly: { keyword: 'writeOnly' }\n uuid: { keyword: 'uuid' }\n email: { keyword: 'email' }\n firstName: { keyword: 'firstName' }\n lastName: { keyword: 'lastName' }\n phone: { keyword: 'phone' }\n password: { keyword: 'password' }\n date: { keyword: 'date'; args: { type?: 'date' | 'string' } }\n time: { keyword: 'time'; args: { type?: 'date' | 'string' } }\n datetime: { keyword: 'datetime'; args: { offset?: boolean; local?: boolean } }\n tuple: { keyword: 'tuple'; args: { items: Schema[]; min?: number; max?: number; rest?: Schema } }\n array: {\n keyword: 'array'\n args: { items: Schema[]; min?: number; max?: number; unique?: boolean }\n }\n enum: {\n keyword: 'enum'\n args: {\n name: string\n typeName: string\n asConst: boolean\n items: Array<{\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }>\n }\n }\n and: { keyword: 'and'; args: Schema[] }\n const: {\n keyword: 'const'\n args: {\n name: string | number\n format: 'string' | 'number' | 'boolean'\n value?: string | number | boolean\n }\n }\n union: { keyword: 'union'; args: Schema[] }\n ref: {\n keyword: 'ref'\n args: {\n name: string\n $ref: string\n /**\n * Full qualified path.\n */\n path: KubbFile.Path\n /**\n * When true `File.Import` will be used.\n * When false a reference will be used inside the current file.\n */\n isImportable: boolean\n }\n }\n matches: { keyword: 'matches'; args?: string }\n boolean: { keyword: 'boolean' }\n default: { keyword: 'default'; args: string | number | boolean }\n string: { keyword: 'string' }\n integer: { keyword: 'integer' }\n number: { keyword: 'number' }\n max: { keyword: 'max'; args: number }\n min: { keyword: 'min'; args: number }\n exclusiveMaximum: { keyword: 'exclusiveMaximum'; args: number }\n exclusiveMinimum: { keyword: 'exclusiveMinimum'; args: number }\n describe: { keyword: 'describe'; args: string }\n example: { keyword: 'example'; args: string }\n deprecated: { keyword: 'deprecated' }\n optional: { keyword: 'optional' }\n undefined: { keyword: 'undefined' }\n nullish: { keyword: 'nullish' }\n nullable: { keyword: 'nullable' }\n null: { keyword: 'null' }\n any: { keyword: 'any' }\n unknown: { keyword: 'unknown' }\n void: { keyword: 'void' }\n blob: { keyword: 'blob' }\n schema: { keyword: 'schema'; args: { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; format?: string } }\n name: { keyword: 'name'; args: string }\n catchall: { keyword: 'catchall' }\n interface: { keyword: 'interface' }\n}\n\nexport const schemaKeywords = {\n any: 'any',\n unknown: 'unknown',\n number: 'number',\n integer: 'integer',\n string: 'string',\n boolean: 'boolean',\n undefined: 'undefined',\n nullable: 'nullable',\n null: 'null',\n nullish: 'nullish',\n array: 'array',\n tuple: 'tuple',\n enum: 'enum',\n union: 'union',\n datetime: 'datetime',\n date: 'date',\n email: 'email',\n uuid: 'uuid',\n url: 'url',\n void: 'void',\n /* intersection */\n default: 'default',\n const: 'const',\n and: 'and',\n describe: 'describe',\n min: 'min',\n max: 'max',\n exclusiveMinimum: 'exclusiveMinimum',\n exclusiveMaximum: 'exclusiveMaximum',\n optional: 'optional',\n readOnly: 'readOnly',\n writeOnly: 'writeOnly',\n\n // custom ones\n object: 'object',\n ref: 'ref',\n matches: 'matches',\n firstName: 'firstName',\n lastName: 'lastName',\n password: 'password',\n phone: 'phone',\n blob: 'blob',\n deprecated: 'deprecated',\n example: 'example',\n schema: 'schema',\n catchall: 'catchall',\n time: 'time',\n name: 'name',\n interface: 'interface',\n} satisfies {\n [K in keyof SchemaKeywordMapper]: SchemaKeywordMapper[K]['keyword']\n}\n\nexport type SchemaKeyword = keyof SchemaKeywordMapper\n\nexport type SchemaMapper<T = string | null | undefined> = {\n [K in keyof SchemaKeywordMapper]: (() => T | undefined) | undefined\n}\n\nexport type SchemaKeywordBase<T> = {\n keyword: SchemaKeyword\n args: T\n}\n\nexport type Schema = { keyword: string } | SchemaKeywordMapper[keyof SchemaKeywordMapper]\n\nexport type SchemaTree = {\n schema: SchemaObject\n parent: Schema | undefined\n current: Schema\n siblings: Schema[]\n /**\n * this will be equal to the key of a property(object)\n */\n name?: string\n}\n\nexport function isKeyword<T extends Schema, K extends keyof SchemaKeywordMapper>(meta: T, keyword: K): meta is Extract<T, SchemaKeywordMapper[K]> {\n return meta.keyword === keyword\n}\n"],"mappings":";AAiGA,MAAa,iBAAiB;CAC5B,KAAK;CACL,SAAS;CACT,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;CACT,WAAW;CACX,UAAU;CACV,MAAM;CACN,SAAS;CACT,OAAO;CACP,OAAO;CACP,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;CACN,OAAO;CACP,MAAM;CACN,KAAK;CACL,MAAM;CAEN,SAAS;CACT,OAAO;CACP,KAAK;CACL,UAAU;CACV,KAAK;CACL,KAAK;CACL,kBAAkB;CAClB,kBAAkB;CAClB,UAAU;CACV,UAAU;CACV,WAAW;CAGX,QAAQ;CACR,KAAK;CACL,SAAS;CACT,WAAW;CACX,UAAU;CACV,UAAU;CACV,OAAO;CACP,MAAM;CACN,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACN,MAAM;CACN,WAAW;CACZ;AA4BD,SAAgB,UAAiE,MAAS,SAAwD;AAChJ,QAAO,KAAK,YAAY"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Plugin, D as AsyncEventEmitter, O as KubbEvents, S as Output, T as ResolveNameParams, _ as contentType, b as Config, d as HttpMethod, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, k as BaseGenerator, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions, x as Group, y as PluginManager } from "./SchemaMapper-
|
|
1
|
+
import { C as Plugin, D as AsyncEventEmitter, O as KubbEvents, S as Output, T as ResolveNameParams, _ as contentType, b as Config, d as HttpMethod, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, k as BaseGenerator, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions, x as Group, y as PluginManager } from "./SchemaMapper-DHoFzVaG.cjs";
|
|
2
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
3
|
import { Fabric } from "@kubb/react-fabric";
|
|
4
4
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
@@ -264,14 +264,14 @@ type SchemaGeneratorOptions = {
|
|
|
264
264
|
* TODO TODO add docs
|
|
265
265
|
* @beta
|
|
266
266
|
*/
|
|
267
|
-
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema
|
|
267
|
+
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
|
|
268
268
|
};
|
|
269
269
|
};
|
|
270
270
|
type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
|
|
271
271
|
type SchemaProps$1 = {
|
|
272
|
-
|
|
273
|
-
name
|
|
274
|
-
parentName
|
|
272
|
+
schema: SchemaObject | null;
|
|
273
|
+
name: string | null;
|
|
274
|
+
parentName: string | null;
|
|
275
275
|
};
|
|
276
276
|
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
277
277
|
#private;
|
|
@@ -353,4 +353,4 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
|
353
353
|
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions>;
|
|
354
354
|
//#endregion
|
|
355
355
|
export { Resolver as C, ResolvePathOptions as S, Options as _, createReactGenerator as a, Ref as b, SchemaGeneratorBuildOptions as c, OperationGenerator as d, OperationMethodResult as f, OperationSchemas as g, OperationSchema as h, ReactGenerator as i, SchemaGeneratorOptions as l, Include as m, createGenerator as n, GetSchemaGeneratorOptions as o, Exclude as p, Generator as r, SchemaGenerator as s, CoreGenerator as t, SchemaMethodResult as u, Override as v, FunctionParamsAST as w, Refs as x, PluginOas as y };
|
|
356
|
-
//# sourceMappingURL=createGenerator-
|
|
356
|
+
//# sourceMappingURL=createGenerator-BOeO1z4V.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Plugin, D as AsyncEventEmitter, O as KubbEvents, S as Output, T as ResolveNameParams, _ as contentType, b as Config, d as HttpMethod, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, k as BaseGenerator, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions, x as Group, y as PluginManager } from "./SchemaMapper-
|
|
1
|
+
import { C as Plugin, D as AsyncEventEmitter, O as KubbEvents, S as Output, T as ResolveNameParams, _ as contentType, b as Config, d as HttpMethod, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, k as BaseGenerator, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions, x as Group, y as PluginManager } from "./SchemaMapper-BQqC-HKo.js";
|
|
2
2
|
import { Fabric } from "@kubb/react-fabric";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
import { KubbNode } from "@kubb/react-fabric/types";
|
|
@@ -264,14 +264,14 @@ type SchemaGeneratorOptions = {
|
|
|
264
264
|
* TODO TODO add docs
|
|
265
265
|
* @beta
|
|
266
266
|
*/
|
|
267
|
-
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Schema
|
|
267
|
+
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
|
|
268
268
|
};
|
|
269
269
|
};
|
|
270
270
|
type SchemaGeneratorBuildOptions = Omit<OperationSchema, 'name' | 'schema'>;
|
|
271
271
|
type SchemaProps$1 = {
|
|
272
|
-
|
|
273
|
-
name
|
|
274
|
-
parentName
|
|
272
|
+
schema: SchemaObject | null;
|
|
273
|
+
name: string | null;
|
|
274
|
+
parentName: string | null;
|
|
275
275
|
};
|
|
276
276
|
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
277
277
|
#private;
|
|
@@ -353,4 +353,4 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
|
353
353
|
declare function createGenerator<TOptions extends PluginFactoryOptions>(generator: UserGenerator<TOptions>): CoreGenerator<TOptions>;
|
|
354
354
|
//#endregion
|
|
355
355
|
export { Resolver as C, ResolvePathOptions as S, Options as _, createReactGenerator as a, Ref as b, SchemaGeneratorBuildOptions as c, OperationGenerator as d, OperationMethodResult as f, OperationSchemas as g, OperationSchema as h, ReactGenerator as i, SchemaGeneratorOptions as l, Include as m, createGenerator as n, GetSchemaGeneratorOptions as o, Exclude as p, Generator as r, SchemaGenerator as s, CoreGenerator as t, SchemaMethodResult as u, Override as v, FunctionParamsAST as w, Refs as x, PluginOas as y };
|
|
356
|
-
//# sourceMappingURL=createGenerator-
|
|
356
|
+
//# sourceMappingURL=createGenerator-BPhjS5cM.d.ts.map
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./SchemaMapper-
|
|
2
|
-
import { a as createReactGenerator, n as createGenerator, r as Generator, t as CoreGenerator, y as PluginOas } from "./createGenerator-
|
|
1
|
+
import "./SchemaMapper-DHoFzVaG.cjs";
|
|
2
|
+
import { a as createReactGenerator, n as createGenerator, r as Generator, t as CoreGenerator, y as PluginOas } from "./createGenerator-BOeO1z4V.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/jsonGenerator.d.ts
|
|
5
5
|
declare const jsonGenerator: CoreGenerator<PluginOas>;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./SchemaMapper-
|
|
2
|
-
import { a as createReactGenerator, n as createGenerator, r as Generator, t as CoreGenerator, y as PluginOas } from "./createGenerator-
|
|
1
|
+
import "./SchemaMapper-BQqC-HKo.js";
|
|
2
|
+
import { a as createReactGenerator, n as createGenerator, r as Generator, t as CoreGenerator, y as PluginOas } from "./createGenerator-BPhjS5cM.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/jsonGenerator.d.ts
|
|
5
5
|
declare const jsonGenerator: CoreGenerator<PluginOas>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSchemas-DFlFfjx-.cjs","names":["sorted: string[]","sortedSchemas: Record<string, OasTypes.SchemaObject>","schemas: Record<string, OasTypes.SchemaObject>"],"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.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
|
|
1
|
+
{"version":3,"file":"getSchemas-DFlFfjx-.cjs","names":["sorted: string[]","sortedSchemas: Record<string, OasTypes.SchemaObject>","schemas: Record<string, OasTypes.SchemaObject>"],"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.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","import type { contentType, Oas, OasTypes } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\n/**\n * Collect all schema $ref dependencies recursively.\n */\nfunction collectRefs(schema: unknown, refs = new Set<string>()): Set<string> {\n if (Array.isArray(schema)) {\n for (const item of schema) {\n collectRefs(item, refs)\n }\n return refs\n }\n\n if (schema && typeof schema === 'object') {\n for (const [key, value] of Object.entries(schema)) {\n if (key === '$ref' && typeof value === 'string') {\n const match = value.match(/^#\\/components\\/schemas\\/(.+)$/)\n if (match) {\n refs.add(match[1]!)\n }\n } else {\n collectRefs(value, refs)\n }\n }\n }\n\n return refs\n}\n\n/**\n * Sort schemas topologically so referenced schemas appear first.\n */\nfunction sortSchemas(schemas: Record<string, OasTypes.SchemaObject>): Record<string, OasTypes.SchemaObject> {\n const deps = new Map<string, string[]>()\n\n for (const [name, schema] of Object.entries(schemas)) {\n deps.set(name, Array.from(collectRefs(schema)))\n }\n\n const sorted: string[] = []\n const visited = new Set<string>()\n\n function visit(name: string, stack = new Set<string>()) {\n if (visited.has(name)) {\n return\n }\n if (stack.has(name)) {\n return\n } // circular refs, ignore\n stack.add(name)\n const children = deps.get(name) || []\n for (const child of children) {\n if (deps.has(child)) {\n visit(child, stack)\n }\n }\n stack.delete(name)\n visited.add(name)\n sorted.push(name)\n }\n\n for (const name of Object.keys(schemas)) {\n visit(name)\n }\n\n const sortedSchemas: Record<string, OasTypes.SchemaObject> = {}\n for (const name of sorted) {\n sortedSchemas[name] = schemas[name]!\n }\n return sortedSchemas\n}\n\n/**\n * Collect schemas from OpenAPI components (schemas, responses, requestBodies)\n * and return them in dependency order.\n */\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n for (const [name, response] of Object.entries(responses)) {\n const responseObject = response as OasTypes.ResponseObject\n if (responseObject.content && !schemas[name]) {\n const firstContentType = Object.keys(responseObject.content)[0] || 'application/json'\n schemas[name] = responseObject.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n }\n }\n\n if (includes.includes('requestBodies')) {\n const requestBodies = components?.requestBodies || {}\n for (const [name, request] of Object.entries(requestBodies)) {\n const requestObject = request as OasTypes.RequestBodyObject\n if (requestObject.content && !schemas[name]) {\n const firstContentType = Object.keys(requestObject.content)[0] || 'application/json'\n schemas[name] = requestObject.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n }\n }\n\n return sortSchemas(schemas)\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;;;;;;;;;AC3BL,SAAS,YAAY,QAAiB,uBAAO,IAAI,KAAa,EAAe;AAC3E,KAAI,MAAM,QAAQ,OAAO,EAAE;AACzB,OAAK,MAAM,QAAQ,OACjB,aAAY,MAAM,KAAK;AAEzB,SAAO;;AAGT,KAAI,UAAU,OAAO,WAAW,SAC9B,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAC/C,KAAI,QAAQ,UAAU,OAAO,UAAU,UAAU;EAC/C,MAAM,QAAQ,MAAM,MAAM,iCAAiC;AAC3D,MAAI,MACF,MAAK,IAAI,MAAM,GAAI;OAGrB,aAAY,OAAO,KAAK;AAK9B,QAAO;;;;;AAMT,SAAS,YAAY,SAAuF;CAC1G,MAAM,uBAAO,IAAI,KAAuB;AAExC,MAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,QAAQ,CAClD,MAAK,IAAI,MAAM,MAAM,KAAK,YAAY,OAAO,CAAC,CAAC;CAGjD,MAAMA,SAAmB,EAAE;CAC3B,MAAM,0BAAU,IAAI,KAAa;CAEjC,SAAS,MAAM,MAAc,wBAAQ,IAAI,KAAa,EAAE;AACtD,MAAI,QAAQ,IAAI,KAAK,CACnB;AAEF,MAAI,MAAM,IAAI,KAAK,CACjB;AAEF,QAAM,IAAI,KAAK;EACf,MAAM,WAAW,KAAK,IAAI,KAAK,IAAI,EAAE;AACrC,OAAK,MAAM,SAAS,SAClB,KAAI,KAAK,IAAI,MAAM,CACjB,OAAM,OAAO,MAAM;AAGvB,QAAM,OAAO,KAAK;AAClB,UAAQ,IAAI,KAAK;AACjB,SAAO,KAAK,KAAK;;AAGnB,MAAK,MAAM,QAAQ,OAAO,KAAK,QAAQ,CACrC,OAAM,KAAK;CAGb,MAAMC,gBAAuD,EAAE;AAC/D,MAAK,MAAM,QAAQ,OACjB,eAAc,QAAQ,QAAQ;AAEhC,QAAO;;;;;;AAOT,SAAgB,WAAW,EAAE,KAAK,aAAa,WAAW;CAAC;CAAW;CAAiB;CAAY,IAA4D;CAC7J,MAAM,aAAa,IAAI,eAAe,CAAC;CACvC,IAAIC,UAAiD,EAAE;AAEvD,KAAI,SAAS,SAAS,UAAU,CAC9B,WAAU;EACR,GAAG;EACH,GAAK,YAAY,WAAqD,EAAE;EACzE;AAGH,KAAI,SAAS,SAAS,YAAY,EAAE;EAClC,MAAM,YAAY,YAAY,aAAa,EAAE;AAC7C,OAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,UAAU,EAAE;GACxD,MAAM,iBAAiB;AACvB,OAAI,eAAe,WAAW,CAAC,QAAQ,OAAO;IAC5C,MAAM,mBAAmB,OAAO,KAAK,eAAe,QAAQ,CAAC,MAAM;AACnE,YAAQ,QAAQ,eAAe,UAAU,eAAe,mBAAmB;;;;AAKjF,KAAI,SAAS,SAAS,gBAAgB,EAAE;EACtC,MAAM,gBAAgB,YAAY,iBAAiB,EAAE;AACrD,OAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,cAAc,EAAE;GAC3D,MAAM,gBAAgB;AACtB,OAAI,cAAc,WAAW,CAAC,QAAQ,OAAO;IAC3C,MAAM,mBAAmB,OAAO,KAAK,cAAc,QAAQ,CAAC,MAAM;AAClE,YAAQ,QAAQ,cAAc,UAAU,eAAe,mBAAmB;;;;AAKhF,QAAO,YAAY,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSchemas-DH7Mz7ud.js","names":["sorted: string[]","sortedSchemas: Record<string, OasTypes.SchemaObject>","schemas: Record<string, OasTypes.SchemaObject>"],"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.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
|
|
1
|
+
{"version":3,"file":"getSchemas-DH7Mz7ud.js","names":["sorted: string[]","sortedSchemas: Record<string, OasTypes.SchemaObject>","schemas: Record<string, OasTypes.SchemaObject>"],"sources":["../src/utils/getSchemaFactory.ts","../src/utils/getSchemas.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","import type { contentType, Oas, OasTypes } from '@kubb/oas'\n\ntype Mode = 'schemas' | 'responses' | 'requestBodies'\n\ntype GetSchemasProps = {\n oas: Oas\n contentType?: contentType\n includes?: Mode[]\n}\n\n/**\n * Collect all schema $ref dependencies recursively.\n */\nfunction collectRefs(schema: unknown, refs = new Set<string>()): Set<string> {\n if (Array.isArray(schema)) {\n for (const item of schema) {\n collectRefs(item, refs)\n }\n return refs\n }\n\n if (schema && typeof schema === 'object') {\n for (const [key, value] of Object.entries(schema)) {\n if (key === '$ref' && typeof value === 'string') {\n const match = value.match(/^#\\/components\\/schemas\\/(.+)$/)\n if (match) {\n refs.add(match[1]!)\n }\n } else {\n collectRefs(value, refs)\n }\n }\n }\n\n return refs\n}\n\n/**\n * Sort schemas topologically so referenced schemas appear first.\n */\nfunction sortSchemas(schemas: Record<string, OasTypes.SchemaObject>): Record<string, OasTypes.SchemaObject> {\n const deps = new Map<string, string[]>()\n\n for (const [name, schema] of Object.entries(schemas)) {\n deps.set(name, Array.from(collectRefs(schema)))\n }\n\n const sorted: string[] = []\n const visited = new Set<string>()\n\n function visit(name: string, stack = new Set<string>()) {\n if (visited.has(name)) {\n return\n }\n if (stack.has(name)) {\n return\n } // circular refs, ignore\n stack.add(name)\n const children = deps.get(name) || []\n for (const child of children) {\n if (deps.has(child)) {\n visit(child, stack)\n }\n }\n stack.delete(name)\n visited.add(name)\n sorted.push(name)\n }\n\n for (const name of Object.keys(schemas)) {\n visit(name)\n }\n\n const sortedSchemas: Record<string, OasTypes.SchemaObject> = {}\n for (const name of sorted) {\n sortedSchemas[name] = schemas[name]!\n }\n return sortedSchemas\n}\n\n/**\n * Collect schemas from OpenAPI components (schemas, responses, requestBodies)\n * and return them in dependency order.\n */\nexport function getSchemas({ oas, contentType, includes = ['schemas', 'requestBodies', 'responses'] }: GetSchemasProps): Record<string, OasTypes.SchemaObject> {\n const components = oas.getDefinition().components\n let schemas: Record<string, OasTypes.SchemaObject> = {}\n\n if (includes.includes('schemas')) {\n schemas = {\n ...schemas,\n ...((components?.schemas as Record<string, OasTypes.SchemaObject>) || {}),\n }\n }\n\n if (includes.includes('responses')) {\n const responses = components?.responses || {}\n for (const [name, response] of Object.entries(responses)) {\n const responseObject = response as OasTypes.ResponseObject\n if (responseObject.content && !schemas[name]) {\n const firstContentType = Object.keys(responseObject.content)[0] || 'application/json'\n schemas[name] = responseObject.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n }\n }\n\n if (includes.includes('requestBodies')) {\n const requestBodies = components?.requestBodies || {}\n for (const [name, request] of Object.entries(requestBodies)) {\n const requestObject = request as OasTypes.RequestBodyObject\n if (requestObject.content && !schemas[name]) {\n const firstContentType = Object.keys(requestObject.content)[0] || 'application/json'\n schemas[name] = requestObject.content?.[contentType || firstContentType]?.schema as OasTypes.SchemaObject\n }\n }\n }\n\n return sortSchemas(schemas)\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;;;;;;;;;AC3BL,SAAS,YAAY,QAAiB,uBAAO,IAAI,KAAa,EAAe;AAC3E,KAAI,MAAM,QAAQ,OAAO,EAAE;AACzB,OAAK,MAAM,QAAQ,OACjB,aAAY,MAAM,KAAK;AAEzB,SAAO;;AAGT,KAAI,UAAU,OAAO,WAAW,SAC9B,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAC/C,KAAI,QAAQ,UAAU,OAAO,UAAU,UAAU;EAC/C,MAAM,QAAQ,MAAM,MAAM,iCAAiC;AAC3D,MAAI,MACF,MAAK,IAAI,MAAM,GAAI;OAGrB,aAAY,OAAO,KAAK;AAK9B,QAAO;;;;;AAMT,SAAS,YAAY,SAAuF;CAC1G,MAAM,uBAAO,IAAI,KAAuB;AAExC,MAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,QAAQ,CAClD,MAAK,IAAI,MAAM,MAAM,KAAK,YAAY,OAAO,CAAC,CAAC;CAGjD,MAAMA,SAAmB,EAAE;CAC3B,MAAM,0BAAU,IAAI,KAAa;CAEjC,SAAS,MAAM,MAAc,wBAAQ,IAAI,KAAa,EAAE;AACtD,MAAI,QAAQ,IAAI,KAAK,CACnB;AAEF,MAAI,MAAM,IAAI,KAAK,CACjB;AAEF,QAAM,IAAI,KAAK;EACf,MAAM,WAAW,KAAK,IAAI,KAAK,IAAI,EAAE;AACrC,OAAK,MAAM,SAAS,SAClB,KAAI,KAAK,IAAI,MAAM,CACjB,OAAM,OAAO,MAAM;AAGvB,QAAM,OAAO,KAAK;AAClB,UAAQ,IAAI,KAAK;AACjB,SAAO,KAAK,KAAK;;AAGnB,MAAK,MAAM,QAAQ,OAAO,KAAK,QAAQ,CACrC,OAAM,KAAK;CAGb,MAAMC,gBAAuD,EAAE;AAC/D,MAAK,MAAM,QAAQ,OACjB,eAAc,QAAQ,QAAQ;AAEhC,QAAO;;;;;;AAOT,SAAgB,WAAW,EAAE,KAAK,aAAa,WAAW;CAAC;CAAW;CAAiB;CAAY,IAA4D;CAC7J,MAAM,aAAa,IAAI,eAAe,CAAC;CACvC,IAAIC,UAAiD,EAAE;AAEvD,KAAI,SAAS,SAAS,UAAU,CAC9B,WAAU;EACR,GAAG;EACH,GAAK,YAAY,WAAqD,EAAE;EACzE;AAGH,KAAI,SAAS,SAAS,YAAY,EAAE;EAClC,MAAM,YAAY,YAAY,aAAa,EAAE;AAC7C,OAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,UAAU,EAAE;GACxD,MAAM,iBAAiB;AACvB,OAAI,eAAe,WAAW,CAAC,QAAQ,OAAO;IAC5C,MAAM,mBAAmB,OAAO,KAAK,eAAe,QAAQ,CAAC,MAAM;AACnE,YAAQ,QAAQ,eAAe,UAAU,eAAe,mBAAmB;;;;AAKjF,KAAI,SAAS,SAAS,gBAAgB,EAAE;EACtC,MAAM,gBAAgB,YAAY,iBAAiB,EAAE;AACrD,OAAK,MAAM,CAAC,MAAM,YAAY,OAAO,QAAQ,cAAc,EAAE;GAC3D,MAAM,gBAAgB;AACtB,OAAI,cAAc,WAAW,CAAC,QAAQ,OAAO;IAC3C,MAAM,mBAAmB,OAAO,KAAK,cAAc,QAAQ,CAAC,MAAM;AAClE,YAAQ,QAAQ,cAAc,UAAU,eAAe,mBAAmB;;;;AAKhF,QAAO,YAAY,QAAQ"}
|
package/dist/hooks.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_SchemaGenerator = require('./SchemaGenerator-
|
|
2
|
+
const require_SchemaGenerator = require('./SchemaGenerator-DTyNa5fQ.cjs');
|
|
3
3
|
const require_SchemaMapper = require('./SchemaMapper-BN2pgCUs.cjs');
|
|
4
4
|
let _kubb_react_fabric = require("@kubb/react-fabric");
|
|
5
5
|
let _kubb_core_hooks = require("@kubb/core/hooks");
|
package/dist/hooks.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Plugin, T as ResolveNameParams, h as Operation, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions } from "./SchemaMapper-
|
|
2
|
-
import { d as OperationGenerator, g as OperationSchemas } from "./createGenerator-
|
|
1
|
+
import { C as Plugin, T as ResolveNameParams, h as Operation, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions } from "./SchemaMapper-DHoFzVaG.cjs";
|
|
2
|
+
import { d as OperationGenerator, g as OperationSchemas } from "./createGenerator-BOeO1z4V.cjs";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useOas.d.ts
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Plugin, T as ResolveNameParams, h as Operation, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions } from "./SchemaMapper-
|
|
2
|
-
import { d as OperationGenerator, g as OperationSchemas } from "./createGenerator-
|
|
1
|
+
import { C as Plugin, T as ResolveNameParams, h as Operation, t as Schema, u as Oas, v as FileMetaBase, w as PluginFactoryOptions } from "./SchemaMapper-BQqC-HKo.js";
|
|
2
|
+
import { d as OperationGenerator, g as OperationSchemas } from "./createGenerator-BPhjS5cM.js";
|
|
3
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
4
|
|
|
5
5
|
//#region src/hooks/useOas.d.ts
|
package/dist/hooks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as SchemaGenerator } from "./SchemaGenerator-
|
|
1
|
+
import { t as SchemaGenerator } from "./SchemaGenerator-DZHRBTyZ.js";
|
|
2
2
|
import { n as schemaKeywords } from "./SchemaMapper-eCHsqfmg.js";
|
|
3
3
|
import { useApp } from "@kubb/react-fabric";
|
|
4
4
|
import { usePlugin, usePluginManager } from "@kubb/core/hooks";
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
2
|
const require_generators = require('./generators-CV6CkJ4H.cjs');
|
|
3
|
-
const require_SchemaGenerator = require('./SchemaGenerator-
|
|
3
|
+
const require_SchemaGenerator = require('./SchemaGenerator-DTyNa5fQ.cjs');
|
|
4
4
|
const require_SchemaMapper = require('./SchemaMapper-BN2pgCUs.cjs');
|
|
5
5
|
let _kubb_core = require("@kubb/core");
|
|
6
6
|
let _kubb_core_transformers = require("@kubb/core/transformers");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Plugin, E as UserPluginWithLifeCycle, a as SchemaMapper, b as Config, c as schemaKeywords, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, n as SchemaKeyword, o as SchemaTree, r as SchemaKeywordBase, s as isKeyword, t as Schema, w as PluginFactoryOptions } from "./SchemaMapper-
|
|
2
|
-
import { C as Resolver, S as ResolvePathOptions, _ as Options, a as createReactGenerator$1, b as Ref, c as SchemaGeneratorBuildOptions, d as OperationGenerator, f as OperationMethodResult, g as OperationSchemas, h as OperationSchema, i as ReactGenerator, l as SchemaGeneratorOptions, m as Include, n as createGenerator$1, o as GetSchemaGeneratorOptions, p as Exclude, r as Generator$1, s as SchemaGenerator, u as SchemaMethodResult, v as Override, x as Refs, y as PluginOas } from "./createGenerator-
|
|
1
|
+
import { C as Plugin, E as UserPluginWithLifeCycle, a as SchemaMapper, b as Config, c as schemaKeywords, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, n as SchemaKeyword, o as SchemaTree, r as SchemaKeywordBase, s as isKeyword, t as Schema, w as PluginFactoryOptions } from "./SchemaMapper-DHoFzVaG.cjs";
|
|
2
|
+
import { C as Resolver, S as ResolvePathOptions, _ as Options, a as createReactGenerator$1, b as Ref, c as SchemaGeneratorBuildOptions, d as OperationGenerator, f as OperationMethodResult, g as OperationSchemas, h as OperationSchema, i as ReactGenerator, l as SchemaGeneratorOptions, m as Include, n as createGenerator$1, o as GetSchemaGeneratorOptions, p as Exclude, r as Generator$1, s as SchemaGenerator, u as SchemaMethodResult, v as Override, x as Refs, y as PluginOas } from "./createGenerator-BOeO1z4V.cjs";
|
|
3
3
|
import { Fabric } from "@kubb/react-fabric";
|
|
4
4
|
|
|
5
5
|
//#region src/createParser.d.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as Plugin, E as UserPluginWithLifeCycle, a as SchemaMapper, b as Config, c as schemaKeywords, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, n as SchemaKeyword, o as SchemaTree, r as SchemaKeywordBase, s as isKeyword, t as Schema, w as PluginFactoryOptions } from "./SchemaMapper-
|
|
2
|
-
import { C as Resolver, S as ResolvePathOptions, _ as Options, a as createReactGenerator$1, b as Ref, c as SchemaGeneratorBuildOptions, d as OperationGenerator, f as OperationMethodResult, g as OperationSchemas, h as OperationSchema, i as ReactGenerator, l as SchemaGeneratorOptions, m as Include, n as createGenerator$1, o as GetSchemaGeneratorOptions, p as Exclude, r as Generator$1, s as SchemaGenerator, u as SchemaMethodResult, v as Override, x as Refs, y as PluginOas } from "./createGenerator-
|
|
1
|
+
import { C as Plugin, E as UserPluginWithLifeCycle, a as SchemaMapper, b as Config, c as schemaKeywords, g as SchemaObject, h as Operation, i as SchemaKeywordMapper, n as SchemaKeyword, o as SchemaTree, r as SchemaKeywordBase, s as isKeyword, t as Schema, w as PluginFactoryOptions } from "./SchemaMapper-BQqC-HKo.js";
|
|
2
|
+
import { C as Resolver, S as ResolvePathOptions, _ as Options, a as createReactGenerator$1, b as Ref, c as SchemaGeneratorBuildOptions, d as OperationGenerator, f as OperationMethodResult, g as OperationSchemas, h as OperationSchema, i as ReactGenerator, l as SchemaGeneratorOptions, m as Include, n as createGenerator$1, o as GetSchemaGeneratorOptions, p as Exclude, r as Generator$1, s as SchemaGenerator, u as SchemaMethodResult, v as Override, x as Refs, y as PluginOas } from "./createGenerator-BPhjS5cM.js";
|
|
3
3
|
import { Fabric } from "@kubb/react-fabric";
|
|
4
4
|
|
|
5
5
|
//#region src/createParser.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as createReactGenerator$1, r as createGenerator$1, t as jsonGenerator } from "./generators-Cw71XBIe.js";
|
|
2
|
-
import { a as pLimit, i as buildSchema, n as buildOperation, r as buildOperations, t as SchemaGenerator } from "./SchemaGenerator-
|
|
2
|
+
import { a as pLimit, i as buildSchema, n as buildOperation, r as buildOperations, t as SchemaGenerator } from "./SchemaGenerator-DZHRBTyZ.js";
|
|
3
3
|
import { n as schemaKeywords, t as isKeyword } from "./SchemaMapper-eCHsqfmg.js";
|
|
4
4
|
import { BaseGenerator, definePlugin, getMode } from "@kubb/core";
|
|
5
5
|
import transformers, { camelCase } from "@kubb/core/transformers";
|
package/dist/mocks.d.cts
CHANGED
package/dist/mocks.d.ts
CHANGED
package/dist/utils.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Output, _ as contentType, b as Config, f as OasTypes, g as SchemaObject, h as Operation, l as isOptional, m as OpenAPIV3_1, p as OpenAPIV3, u as Oas } from "./SchemaMapper-
|
|
2
|
-
import { h as OperationSchema, w as FunctionParamsAST } from "./createGenerator-
|
|
1
|
+
import { S as Output, _ as contentType, b as Config, f as OasTypes, g as SchemaObject, h as Operation, l as isOptional, m as OpenAPIV3_1, p as OpenAPIV3, u as Oas } from "./SchemaMapper-DHoFzVaG.cjs";
|
|
2
|
+
import { h as OperationSchema, w as FunctionParamsAST } from "./createGenerator-BOeO1z4V.cjs";
|
|
3
3
|
import { Params } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/getBanner.d.ts
|
|
@@ -39,16 +39,16 @@ declare function getPathParams(operationSchema: OperationSchema | undefined, opt
|
|
|
39
39
|
* Make it possible to narrow down the schema based on a specific version(3 or 3.1)
|
|
40
40
|
*/
|
|
41
41
|
type SchemaResult<TWithRef extends boolean = false> = {
|
|
42
|
-
schemaObject
|
|
42
|
+
schemaObject: ((TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {
|
|
43
43
|
nullable?: boolean;
|
|
44
44
|
'x-nullable'?: boolean;
|
|
45
|
-
};
|
|
45
|
+
}) | null;
|
|
46
46
|
version: '3.0';
|
|
47
47
|
} | {
|
|
48
|
-
schemaObject
|
|
48
|
+
schemaObject: ((TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {
|
|
49
49
|
nullable?: boolean;
|
|
50
50
|
'x-nullable'?: boolean;
|
|
51
|
-
};
|
|
51
|
+
}) | null;
|
|
52
52
|
version: '3.1';
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
@@ -58,7 +58,7 @@ type SchemaResult<TWithRef extends boolean = false> = {
|
|
|
58
58
|
*
|
|
59
59
|
* @returns A function that takes an optional schema and returns a versioned schema result.
|
|
60
60
|
*/
|
|
61
|
-
declare function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema
|
|
61
|
+
declare function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema: SchemaObject | null) => SchemaResult<TWithRef>;
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/utils/getSchemas.d.ts
|
|
64
64
|
type Mode = 'schemas' | 'responses' | 'requestBodies';
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as Output, _ as contentType, b as Config, f as OasTypes, g as SchemaObject, h as Operation, l as isOptional, m as OpenAPIV3_1, p as OpenAPIV3, u as Oas } from "./SchemaMapper-
|
|
2
|
-
import { h as OperationSchema, w as FunctionParamsAST } from "./createGenerator-
|
|
1
|
+
import { S as Output, _ as contentType, b as Config, f as OasTypes, g as SchemaObject, h as Operation, l as isOptional, m as OpenAPIV3_1, p as OpenAPIV3, u as Oas } from "./SchemaMapper-BQqC-HKo.js";
|
|
2
|
+
import { h as OperationSchema, w as FunctionParamsAST } from "./createGenerator-BPhjS5cM.js";
|
|
3
3
|
import { Params } from "@kubb/react-fabric/types";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/getBanner.d.ts
|
|
@@ -39,16 +39,16 @@ declare function getPathParams(operationSchema: OperationSchema | undefined, opt
|
|
|
39
39
|
* Make it possible to narrow down the schema based on a specific version(3 or 3.1)
|
|
40
40
|
*/
|
|
41
41
|
type SchemaResult<TWithRef extends boolean = false> = {
|
|
42
|
-
schemaObject
|
|
42
|
+
schemaObject: ((TWithRef extends true ? OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject : OpenAPIV3.SchemaObject) & {
|
|
43
43
|
nullable?: boolean;
|
|
44
44
|
'x-nullable'?: boolean;
|
|
45
|
-
};
|
|
45
|
+
}) | null;
|
|
46
46
|
version: '3.0';
|
|
47
47
|
} | {
|
|
48
|
-
schemaObject
|
|
48
|
+
schemaObject: ((TWithRef extends true ? OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject : OpenAPIV3_1.SchemaObject) & {
|
|
49
49
|
nullable?: boolean;
|
|
50
50
|
'x-nullable'?: boolean;
|
|
51
|
-
};
|
|
51
|
+
}) | null;
|
|
52
52
|
version: '3.1';
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
@@ -58,7 +58,7 @@ type SchemaResult<TWithRef extends boolean = false> = {
|
|
|
58
58
|
*
|
|
59
59
|
* @returns A function that takes an optional schema and returns a versioned schema result.
|
|
60
60
|
*/
|
|
61
|
-
declare function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema
|
|
61
|
+
declare function getSchemaFactory<TWithRef extends boolean = false>(oas: Oas): (schema: SchemaObject | null) => SchemaResult<TWithRef>;
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/utils/getSchemas.d.ts
|
|
64
64
|
type Mode = 'schemas' | 'responses' | 'requestBodies';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-oas",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251222160843",
|
|
4
4
|
"description": "OpenAPI Specification (OAS) plugin for Kubb, providing core functionality for parsing and processing OpenAPI/Swagger schemas for code generation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openapi",
|
|
@@ -82,8 +82,8 @@
|
|
|
82
82
|
"@kubb/react-fabric": "0.7.4",
|
|
83
83
|
"p-limit": "^7.2.0",
|
|
84
84
|
"remeda": "^2.32.0",
|
|
85
|
-
"@kubb/core": "0.0.0-canary-
|
|
86
|
-
"@kubb/oas": "0.0.0-canary-
|
|
85
|
+
"@kubb/core": "0.0.0-canary-20251222160843",
|
|
86
|
+
"@kubb/oas": "0.0.0-canary-20251222160843"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"@kubb/react-fabric": "0.7.4"
|