@kubb/swagger-ts 2.0.0-beta.8 → 2.0.0-beta.9

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/index.d.cts CHANGED
@@ -1,12 +1,56 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
2
  import { KubbFile, ResolveNameParams, KubbPlugin, PluginFactoryOptions } from '@kubb/core';
3
3
  import { OasTypes, Exclude, Include, Override, ResolvePathOptions, AppMeta as AppMeta$1 } from '@kubb/swagger';
4
- import { Pipe, Tuples, Fn, Call, Objects, Booleans, Strings } from 'hotscript';
5
- import { JSONSchema, FromSchema } from 'json-schema-to-ts';
4
+ import { Call, Tuples, Objects, Booleans, Strings, Pipe, Fn } from 'hotscript';
6
5
  import { Object as Object$1 } from 'ts-toolbelt';
6
+ import { JSONSchema, FromSchema } from 'json-schema-to-ts';
7
7
  import { TupleToUnion, SplitByDelimiter } from '@kubb/types';
8
8
 
9
9
  declare namespace Checks$5 {
10
+ type AllOFf = {
11
+ allOf: any[];
12
+ };
13
+ type Object = {
14
+ type: 'object';
15
+ properties: any;
16
+ };
17
+ type Properties = {
18
+ properties: any;
19
+ };
20
+ type PropertiesRequired = {
21
+ properties: Record<string, any>;
22
+ required: string[];
23
+ };
24
+ }
25
+ type FixAdditionalPropertiesForAllOf<T> = T extends Checks$5.AllOFf ? Omit<T, 'allOf'> & {
26
+ allOf: Call<Tuples.Map<Objects.Omit<'additionalProperties'>>, T['allOf']>;
27
+ } : T;
28
+ type FixMissingAdditionalProperties<T> = T extends Checks$5.Object ? Omit<T, 'additionalProperties'> & {
29
+ additionalProperties: false;
30
+ } : T;
31
+ type FixMissingTypeObject<T> = T extends Checks$5.Properties ? T & {
32
+ type: 'object';
33
+ } : T;
34
+ type FixExtraRequiredFields<T> = T extends Checks$5.PropertiesRequired ? Omit<T, 'required'> & {
35
+ required: Call<Tuples.Filter<Booleans.Extends<keyof T['properties']>>, T['required']>;
36
+ } : T;
37
+ type FixJSONSchema<T> = FixAdditionalPropertiesForAllOf<FixMissingAdditionalProperties<FixMissingTypeObject<FixExtraRequiredFields<T>>>>;
38
+ type Mutable<Type> = FixJSONSchema<{
39
+ -readonly [Key in keyof Type]: Mutable<Type[Key]>;
40
+ }>;
41
+ type RefToPath<T extends string> = T extends `#/${infer Ref}` ? Call<Strings.Split<'/'>, Ref> : never;
42
+ type ResolveRef<TObj, TRef extends string> = {
43
+ $id: TRef;
44
+ } & Object$1.Path<TObj, RefToPath<TRef>>;
45
+ type ResolveRefInObj<T, TBase> = T extends {
46
+ $ref: infer Ref;
47
+ } ? Ref extends string ? ResolveRef<TBase, Ref> : T : T;
48
+ type ResolveRefsInObj<T, TBase = T> = {
49
+ [K in keyof T]: ResolveRefsInObj<ResolveRefInObj<T[K], TBase>, TBase>;
50
+ };
51
+ type Infer<TOAS> = Mutable<ResolveRefsInObj<TOAS>>;
52
+
53
+ declare namespace Checks$4 {
10
54
  type Required = {
11
55
  required: true;
12
56
  };
@@ -38,35 +82,35 @@ interface ParamPropMap {
38
82
  type JSONSchemaTypeName = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
39
83
  type ParamObj<TParameter extends {
40
84
  name: string;
41
- }> = TParameter extends Checks$5.Required ? {
42
- [TName in TParameter['name']]: TParameter extends Checks$5.Schemas ? FromSchema<TParameter['schema']> : TParameter extends Checks$5.Enum ? FromSchema<{
85
+ }> = TParameter extends Checks$4.Required ? {
86
+ [TName in TParameter['name']]: TParameter extends Checks$4.Schemas ? FromSchema<TParameter['schema']> : TParameter extends Checks$4.Enum ? FromSchema<{
43
87
  type: TParameter['type'];
44
88
  enum: TParameter['enum'];
45
89
  }> : unknown;
46
90
  } : {
47
- [TName in TParameter['name']]?: TParameter extends Checks$5.Schemas ? FromSchema<TParameter['schema']> : TParameter extends Checks$5.Enum ? FromSchema<{
91
+ [TName in TParameter['name']]?: TParameter extends Checks$4.Schemas ? FromSchema<TParameter['schema']> : TParameter extends Checks$4.Enum ? FromSchema<{
48
92
  type: TParameter['type'];
49
93
  enum: TParameter['enum'];
50
94
  }> : unknown;
51
95
  };
52
- interface ParamToRequestParam<TParameters extends Checks$5.Parameters> extends Fn {
96
+ interface ParamToRequestParam<TParameters extends Checks$4.Parameters> extends Fn {
53
97
  return: this['arg0'] extends {
54
98
  name: string;
55
99
  in: infer TParamType;
56
- } ? TParameters extends Checks$5.SingleParameter<TParamType> ? {
100
+ } ? TParameters extends Checks$4.SingleParameter<TParamType> ? {
57
101
  [TKey in TParamType extends keyof ParamPropMap ? ParamPropMap[TParamType] : never]: ParamObj<this['arg0']>;
58
102
  } : {
59
103
  [TKey in TParamType extends keyof ParamPropMap ? ParamPropMap[TParamType] : never]?: ParamObj<this['arg0']>;
60
104
  } : {};
61
105
  }
62
- type ParamMap<TParameters extends Checks$5.Parameters> = Pipe<TParameters, [
106
+ type ParamMap<TParameters extends Checks$4.Parameters> = Pipe<TParameters, [
63
107
  Tuples.Map<ParamToRequestParam<TParameters>>,
64
108
  Tuples.ToIntersection
65
109
  ]>;
66
110
  type MethodMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>> = PathMap<TOAS>[TPath];
67
- type StatusMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>> = MethodMap<TOAS, TPath>[TMethod] extends Checks$5.Responses ? MethodMap<TOAS, TPath>[TMethod]['responses'] : never;
111
+ type StatusMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>> = MethodMap<TOAS, TPath>[TMethod] extends Checks$4.Responses ? MethodMap<TOAS, TPath>[TMethod]['responses'] : never;
68
112
 
69
- declare namespace Checks$4 {
113
+ declare namespace Checks$3 {
70
114
  type ModelWithSchemas = {
71
115
  components: {
72
116
  schemas: Record<string, JSONSchema>;
@@ -88,51 +132,7 @@ declare namespace Checks$4 {
88
132
  };
89
133
  };
90
134
  }
91
- type Model<TOAS extends OasTypes.OASDocument, TName extends TOAS extends Checks$4.ModelWithSchemas ? keyof TOAS['components']['schemas'] : TOAS extends Checks$4.ModelWithDefinitions ? keyof TOAS['definitions'] : never> = TOAS extends Checks$4.ModelWithSchemasNamed<TName> ? FromSchema<TOAS['components']['schemas'][TName]> : TOAS extends Checks$4.ModelWithDefinitionsNamed<TName> ? FromSchema<TOAS['definitions'][TName]> : never;
92
-
93
- declare namespace Checks$3 {
94
- type AllOFf = {
95
- allOf: any[];
96
- };
97
- type Object = {
98
- type: 'object';
99
- properties: any;
100
- };
101
- type Properties = {
102
- properties: any;
103
- };
104
- type PropertiesRequired = {
105
- properties: Record<string, any>;
106
- required: string[];
107
- };
108
- }
109
- type FixAdditionalPropertiesForAllOf<T> = T extends Checks$3.AllOFf ? Omit<T, 'allOf'> & {
110
- allOf: Call<Tuples.Map<Objects.Omit<'additionalProperties'>>, T['allOf']>;
111
- } : T;
112
- type FixMissingAdditionalProperties<T> = T extends Checks$3.Object ? Omit<T, 'additionalProperties'> & {
113
- additionalProperties: false;
114
- } : T;
115
- type FixMissingTypeObject<T> = T extends Checks$3.Properties ? T & {
116
- type: 'object';
117
- } : T;
118
- type FixExtraRequiredFields<T> = T extends Checks$3.PropertiesRequired ? Omit<T, 'required'> & {
119
- required: Call<Tuples.Filter<Booleans.Extends<keyof T['properties']>>, T['required']>;
120
- } : T;
121
- type FixJSONSchema<T> = FixAdditionalPropertiesForAllOf<FixMissingAdditionalProperties<FixMissingTypeObject<FixExtraRequiredFields<T>>>>;
122
- type Mutable<Type> = FixJSONSchema<{
123
- -readonly [Key in keyof Type]: Mutable<Type[Key]>;
124
- }>;
125
- type RefToPath<T extends string> = T extends `#/${infer Ref}` ? Call<Strings.Split<'/'>, Ref> : never;
126
- type ResolveRef<TObj, TRef extends string> = {
127
- $id: TRef;
128
- } & Object$1.Path<TObj, RefToPath<TRef>>;
129
- type ResolveRefInObj<T, TBase> = T extends {
130
- $ref: infer Ref;
131
- } ? Ref extends string ? ResolveRef<TBase, Ref> : T : T;
132
- type ResolveRefsInObj<T, TBase = T> = {
133
- [K in keyof T]: ResolveRefsInObj<ResolveRefInObj<T[K], TBase>, TBase>;
134
- };
135
- type Parse<TOAS> = Mutable<ResolveRefsInObj<TOAS>>;
135
+ type Model<TOAS extends OasTypes.OASDocument, TName extends TOAS extends Checks$3.ModelWithSchemas ? keyof TOAS['components']['schemas'] : TOAS extends Checks$3.ModelWithDefinitions ? keyof TOAS['definitions'] : never> = TOAS extends Checks$3.ModelWithSchemasNamed<TName> ? FromSchema<TOAS['components']['schemas'][TName]> : TOAS extends Checks$3.ModelWithDefinitionsNamed<TName> ? FromSchema<TOAS['definitions'][TName]> : never;
136
136
 
137
137
  declare namespace Checks$2 {
138
138
  type Security = {
@@ -380,15 +380,15 @@ type ResponseSchemas<TOAS extends OasTypes.OASDocument, TPath extends keyof Path
380
380
  type JSONResponseSchema<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>, TStatus extends keyof StatusMap<TOAS, TPath, TMethod>> = StatusMap<TOAS, TPath, TMethod>[TStatus] extends Checks.Content ? ResponseSchemas<TOAS, TPath, TMethod, TStatus>[keyof ResponseSchemas<TOAS, TPath, TMethod, TStatus>]['schema'] : StatusMap<TOAS, TPath, TMethod>[TStatus]['schema'];
381
381
  type Response<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>, TStatusCode extends keyof StatusMap<TOAS, TPath, TMethod> = 200> = FromSchema<JSONResponseSchema<TOAS, TPath, TMethod, TStatusCode>>;
382
382
 
383
+ type index_Infer<TOAS> = Infer<TOAS>;
383
384
  type index_MethodMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>> = MethodMap<TOAS, TPath>;
384
- type index_Model<TOAS extends OasTypes.OASDocument, TName extends TOAS extends Checks$4.ModelWithSchemas ? keyof TOAS['components']['schemas'] : TOAS extends Checks$4.ModelWithDefinitions ? keyof TOAS['definitions'] : never> = Model<TOAS, TName>;
385
- type index_Parse<TOAS> = Parse<TOAS>;
385
+ type index_Model<TOAS extends OasTypes.OASDocument, TName extends TOAS extends Checks$3.ModelWithSchemas ? keyof TOAS['components']['schemas'] : TOAS extends Checks$3.ModelWithDefinitions ? keyof TOAS['definitions'] : never> = Model<TOAS, TName>;
386
386
  type index_PathMap<TOAS extends OasTypes.OASDocument> = PathMap<TOAS>;
387
387
  type index_RequestParams<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>> = RequestParams<TOAS, TPath, TMethod>;
388
388
  type index_Response<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>, TStatusCode extends keyof StatusMap<TOAS, TPath, TMethod> = 200> = Response<TOAS, TPath, TMethod, TStatusCode>;
389
389
  type index_StatusMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>> = StatusMap<TOAS, TPath, TMethod>;
390
390
  declare namespace index {
391
- export type { index_MethodMap as MethodMap, index_Model as Model, index_Parse as Parse, index_PathMap as PathMap, index_RequestParams as RequestParams, index_Response as Response, index_StatusMap as StatusMap };
391
+ export type { index_Infer as Infer, index_MethodMap as MethodMap, index_Model as Model, index_PathMap as PathMap, index_RequestParams as RequestParams, index_Response as Response, index_StatusMap as StatusMap };
392
392
  }
393
393
 
394
394
  type Options = {
@@ -462,9 +462,7 @@ type Options = {
462
462
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
463
463
  };
464
464
  /**
465
- * Export Oas object as Oas type with import type { Infer } from `@kubb/swagger-ts/infer`
466
- * TODO add docs
467
- * @beta
465
+ * Export an Oas object as Oas type with `import type { Infer } from '@kubb/swagger-ts/oas'`
468
466
  */
469
467
  oasType?: boolean;
470
468
  };
@@ -493,4 +491,4 @@ declare const pluginName = "swagger-ts";
493
491
  declare const pluginKey: PluginOptions['key'];
494
492
  declare const definePlugin: (options: Options) => _kubb_core.KubbUserPluginWithLifeCycle<PluginOptions>;
495
493
 
496
- export { type FileMeta, index as Infer, type Options, type PluginOptions, definePlugin as default, definePlugin, pluginKey, pluginName };
494
+ export { type FileMeta, index as Oas, type Options, type PluginOptions, definePlugin as default, definePlugin, pluginKey, pluginName };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,56 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
2
  import { KubbFile, ResolveNameParams, KubbPlugin, PluginFactoryOptions } from '@kubb/core';
3
3
  import { OasTypes, Exclude, Include, Override, ResolvePathOptions, AppMeta as AppMeta$1 } from '@kubb/swagger';
4
- import { Pipe, Tuples, Fn, Call, Objects, Booleans, Strings } from 'hotscript';
5
- import { JSONSchema, FromSchema } from 'json-schema-to-ts';
4
+ import { Call, Tuples, Objects, Booleans, Strings, Pipe, Fn } from 'hotscript';
6
5
  import { Object as Object$1 } from 'ts-toolbelt';
6
+ import { JSONSchema, FromSchema } from 'json-schema-to-ts';
7
7
  import { TupleToUnion, SplitByDelimiter } from '@kubb/types';
8
8
 
9
9
  declare namespace Checks$5 {
10
+ type AllOFf = {
11
+ allOf: any[];
12
+ };
13
+ type Object = {
14
+ type: 'object';
15
+ properties: any;
16
+ };
17
+ type Properties = {
18
+ properties: any;
19
+ };
20
+ type PropertiesRequired = {
21
+ properties: Record<string, any>;
22
+ required: string[];
23
+ };
24
+ }
25
+ type FixAdditionalPropertiesForAllOf<T> = T extends Checks$5.AllOFf ? Omit<T, 'allOf'> & {
26
+ allOf: Call<Tuples.Map<Objects.Omit<'additionalProperties'>>, T['allOf']>;
27
+ } : T;
28
+ type FixMissingAdditionalProperties<T> = T extends Checks$5.Object ? Omit<T, 'additionalProperties'> & {
29
+ additionalProperties: false;
30
+ } : T;
31
+ type FixMissingTypeObject<T> = T extends Checks$5.Properties ? T & {
32
+ type: 'object';
33
+ } : T;
34
+ type FixExtraRequiredFields<T> = T extends Checks$5.PropertiesRequired ? Omit<T, 'required'> & {
35
+ required: Call<Tuples.Filter<Booleans.Extends<keyof T['properties']>>, T['required']>;
36
+ } : T;
37
+ type FixJSONSchema<T> = FixAdditionalPropertiesForAllOf<FixMissingAdditionalProperties<FixMissingTypeObject<FixExtraRequiredFields<T>>>>;
38
+ type Mutable<Type> = FixJSONSchema<{
39
+ -readonly [Key in keyof Type]: Mutable<Type[Key]>;
40
+ }>;
41
+ type RefToPath<T extends string> = T extends `#/${infer Ref}` ? Call<Strings.Split<'/'>, Ref> : never;
42
+ type ResolveRef<TObj, TRef extends string> = {
43
+ $id: TRef;
44
+ } & Object$1.Path<TObj, RefToPath<TRef>>;
45
+ type ResolveRefInObj<T, TBase> = T extends {
46
+ $ref: infer Ref;
47
+ } ? Ref extends string ? ResolveRef<TBase, Ref> : T : T;
48
+ type ResolveRefsInObj<T, TBase = T> = {
49
+ [K in keyof T]: ResolveRefsInObj<ResolveRefInObj<T[K], TBase>, TBase>;
50
+ };
51
+ type Infer<TOAS> = Mutable<ResolveRefsInObj<TOAS>>;
52
+
53
+ declare namespace Checks$4 {
10
54
  type Required = {
11
55
  required: true;
12
56
  };
@@ -38,35 +82,35 @@ interface ParamPropMap {
38
82
  type JSONSchemaTypeName = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
39
83
  type ParamObj<TParameter extends {
40
84
  name: string;
41
- }> = TParameter extends Checks$5.Required ? {
42
- [TName in TParameter['name']]: TParameter extends Checks$5.Schemas ? FromSchema<TParameter['schema']> : TParameter extends Checks$5.Enum ? FromSchema<{
85
+ }> = TParameter extends Checks$4.Required ? {
86
+ [TName in TParameter['name']]: TParameter extends Checks$4.Schemas ? FromSchema<TParameter['schema']> : TParameter extends Checks$4.Enum ? FromSchema<{
43
87
  type: TParameter['type'];
44
88
  enum: TParameter['enum'];
45
89
  }> : unknown;
46
90
  } : {
47
- [TName in TParameter['name']]?: TParameter extends Checks$5.Schemas ? FromSchema<TParameter['schema']> : TParameter extends Checks$5.Enum ? FromSchema<{
91
+ [TName in TParameter['name']]?: TParameter extends Checks$4.Schemas ? FromSchema<TParameter['schema']> : TParameter extends Checks$4.Enum ? FromSchema<{
48
92
  type: TParameter['type'];
49
93
  enum: TParameter['enum'];
50
94
  }> : unknown;
51
95
  };
52
- interface ParamToRequestParam<TParameters extends Checks$5.Parameters> extends Fn {
96
+ interface ParamToRequestParam<TParameters extends Checks$4.Parameters> extends Fn {
53
97
  return: this['arg0'] extends {
54
98
  name: string;
55
99
  in: infer TParamType;
56
- } ? TParameters extends Checks$5.SingleParameter<TParamType> ? {
100
+ } ? TParameters extends Checks$4.SingleParameter<TParamType> ? {
57
101
  [TKey in TParamType extends keyof ParamPropMap ? ParamPropMap[TParamType] : never]: ParamObj<this['arg0']>;
58
102
  } : {
59
103
  [TKey in TParamType extends keyof ParamPropMap ? ParamPropMap[TParamType] : never]?: ParamObj<this['arg0']>;
60
104
  } : {};
61
105
  }
62
- type ParamMap<TParameters extends Checks$5.Parameters> = Pipe<TParameters, [
106
+ type ParamMap<TParameters extends Checks$4.Parameters> = Pipe<TParameters, [
63
107
  Tuples.Map<ParamToRequestParam<TParameters>>,
64
108
  Tuples.ToIntersection
65
109
  ]>;
66
110
  type MethodMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>> = PathMap<TOAS>[TPath];
67
- type StatusMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>> = MethodMap<TOAS, TPath>[TMethod] extends Checks$5.Responses ? MethodMap<TOAS, TPath>[TMethod]['responses'] : never;
111
+ type StatusMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>> = MethodMap<TOAS, TPath>[TMethod] extends Checks$4.Responses ? MethodMap<TOAS, TPath>[TMethod]['responses'] : never;
68
112
 
69
- declare namespace Checks$4 {
113
+ declare namespace Checks$3 {
70
114
  type ModelWithSchemas = {
71
115
  components: {
72
116
  schemas: Record<string, JSONSchema>;
@@ -88,51 +132,7 @@ declare namespace Checks$4 {
88
132
  };
89
133
  };
90
134
  }
91
- type Model<TOAS extends OasTypes.OASDocument, TName extends TOAS extends Checks$4.ModelWithSchemas ? keyof TOAS['components']['schemas'] : TOAS extends Checks$4.ModelWithDefinitions ? keyof TOAS['definitions'] : never> = TOAS extends Checks$4.ModelWithSchemasNamed<TName> ? FromSchema<TOAS['components']['schemas'][TName]> : TOAS extends Checks$4.ModelWithDefinitionsNamed<TName> ? FromSchema<TOAS['definitions'][TName]> : never;
92
-
93
- declare namespace Checks$3 {
94
- type AllOFf = {
95
- allOf: any[];
96
- };
97
- type Object = {
98
- type: 'object';
99
- properties: any;
100
- };
101
- type Properties = {
102
- properties: any;
103
- };
104
- type PropertiesRequired = {
105
- properties: Record<string, any>;
106
- required: string[];
107
- };
108
- }
109
- type FixAdditionalPropertiesForAllOf<T> = T extends Checks$3.AllOFf ? Omit<T, 'allOf'> & {
110
- allOf: Call<Tuples.Map<Objects.Omit<'additionalProperties'>>, T['allOf']>;
111
- } : T;
112
- type FixMissingAdditionalProperties<T> = T extends Checks$3.Object ? Omit<T, 'additionalProperties'> & {
113
- additionalProperties: false;
114
- } : T;
115
- type FixMissingTypeObject<T> = T extends Checks$3.Properties ? T & {
116
- type: 'object';
117
- } : T;
118
- type FixExtraRequiredFields<T> = T extends Checks$3.PropertiesRequired ? Omit<T, 'required'> & {
119
- required: Call<Tuples.Filter<Booleans.Extends<keyof T['properties']>>, T['required']>;
120
- } : T;
121
- type FixJSONSchema<T> = FixAdditionalPropertiesForAllOf<FixMissingAdditionalProperties<FixMissingTypeObject<FixExtraRequiredFields<T>>>>;
122
- type Mutable<Type> = FixJSONSchema<{
123
- -readonly [Key in keyof Type]: Mutable<Type[Key]>;
124
- }>;
125
- type RefToPath<T extends string> = T extends `#/${infer Ref}` ? Call<Strings.Split<'/'>, Ref> : never;
126
- type ResolveRef<TObj, TRef extends string> = {
127
- $id: TRef;
128
- } & Object$1.Path<TObj, RefToPath<TRef>>;
129
- type ResolveRefInObj<T, TBase> = T extends {
130
- $ref: infer Ref;
131
- } ? Ref extends string ? ResolveRef<TBase, Ref> : T : T;
132
- type ResolveRefsInObj<T, TBase = T> = {
133
- [K in keyof T]: ResolveRefsInObj<ResolveRefInObj<T[K], TBase>, TBase>;
134
- };
135
- type Parse<TOAS> = Mutable<ResolveRefsInObj<TOAS>>;
135
+ type Model<TOAS extends OasTypes.OASDocument, TName extends TOAS extends Checks$3.ModelWithSchemas ? keyof TOAS['components']['schemas'] : TOAS extends Checks$3.ModelWithDefinitions ? keyof TOAS['definitions'] : never> = TOAS extends Checks$3.ModelWithSchemasNamed<TName> ? FromSchema<TOAS['components']['schemas'][TName]> : TOAS extends Checks$3.ModelWithDefinitionsNamed<TName> ? FromSchema<TOAS['definitions'][TName]> : never;
136
136
 
137
137
  declare namespace Checks$2 {
138
138
  type Security = {
@@ -380,15 +380,15 @@ type ResponseSchemas<TOAS extends OasTypes.OASDocument, TPath extends keyof Path
380
380
  type JSONResponseSchema<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>, TStatus extends keyof StatusMap<TOAS, TPath, TMethod>> = StatusMap<TOAS, TPath, TMethod>[TStatus] extends Checks.Content ? ResponseSchemas<TOAS, TPath, TMethod, TStatus>[keyof ResponseSchemas<TOAS, TPath, TMethod, TStatus>]['schema'] : StatusMap<TOAS, TPath, TMethod>[TStatus]['schema'];
381
381
  type Response<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>, TStatusCode extends keyof StatusMap<TOAS, TPath, TMethod> = 200> = FromSchema<JSONResponseSchema<TOAS, TPath, TMethod, TStatusCode>>;
382
382
 
383
+ type index_Infer<TOAS> = Infer<TOAS>;
383
384
  type index_MethodMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>> = MethodMap<TOAS, TPath>;
384
- type index_Model<TOAS extends OasTypes.OASDocument, TName extends TOAS extends Checks$4.ModelWithSchemas ? keyof TOAS['components']['schemas'] : TOAS extends Checks$4.ModelWithDefinitions ? keyof TOAS['definitions'] : never> = Model<TOAS, TName>;
385
- type index_Parse<TOAS> = Parse<TOAS>;
385
+ type index_Model<TOAS extends OasTypes.OASDocument, TName extends TOAS extends Checks$3.ModelWithSchemas ? keyof TOAS['components']['schemas'] : TOAS extends Checks$3.ModelWithDefinitions ? keyof TOAS['definitions'] : never> = Model<TOAS, TName>;
386
386
  type index_PathMap<TOAS extends OasTypes.OASDocument> = PathMap<TOAS>;
387
387
  type index_RequestParams<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>> = RequestParams<TOAS, TPath, TMethod>;
388
388
  type index_Response<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>, TStatusCode extends keyof StatusMap<TOAS, TPath, TMethod> = 200> = Response<TOAS, TPath, TMethod, TStatusCode>;
389
389
  type index_StatusMap<TOAS extends OasTypes.OASDocument, TPath extends keyof PathMap<TOAS>, TMethod extends keyof MethodMap<TOAS, TPath>> = StatusMap<TOAS, TPath, TMethod>;
390
390
  declare namespace index {
391
- export type { index_MethodMap as MethodMap, index_Model as Model, index_Parse as Parse, index_PathMap as PathMap, index_RequestParams as RequestParams, index_Response as Response, index_StatusMap as StatusMap };
391
+ export type { index_Infer as Infer, index_MethodMap as MethodMap, index_Model as Model, index_PathMap as PathMap, index_RequestParams as RequestParams, index_Response as Response, index_StatusMap as StatusMap };
392
392
  }
393
393
 
394
394
  type Options = {
@@ -462,9 +462,7 @@ type Options = {
462
462
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
463
463
  };
464
464
  /**
465
- * Export Oas object as Oas type with import type { Infer } from `@kubb/swagger-ts/infer`
466
- * TODO add docs
467
- * @beta
465
+ * Export an Oas object as Oas type with `import type { Infer } from '@kubb/swagger-ts/oas'`
468
466
  */
469
467
  oasType?: boolean;
470
468
  };
@@ -493,4 +491,4 @@ declare const pluginName = "swagger-ts";
493
491
  declare const pluginKey: PluginOptions['key'];
494
492
  declare const definePlugin: (options: Options) => _kubb_core.KubbUserPluginWithLifeCycle<PluginOptions>;
495
493
 
496
- export { type FileMeta, index as Infer, type Options, type PluginOptions, definePlugin as default, definePlugin, pluginKey, pluginName };
494
+ export { type FileMeta, index as Oas, type Options, type PluginOptions, definePlugin as default, definePlugin, pluginKey, pluginName };
package/dist/index.js CHANGED
@@ -3609,7 +3609,7 @@ function Template({
3609
3609
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
3610
3610
  `export const ${name} = ${JSON.stringify(api, void 0, 2)} as const`,
3611
3611
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("br", {}),
3612
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Type, { name: typeName, export: true, children: `Parse<typeof ${name}>` })
3612
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Type, { name: typeName, export: true, children: `Infer<typeof ${name}>` })
3613
3613
  ] });
3614
3614
  }
3615
3615
  var defaultTemplates = { default: Template };
@@ -3632,7 +3632,7 @@ Oas.File = function({ name, typeName, templates = defaultTemplates }) {
3632
3632
  path: file.path,
3633
3633
  meta: file.meta,
3634
3634
  children: [
3635
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(File.Import, { name: ["Parse"], path: "@kubb/swagger-ts/infer", isTypeOnly: true }),
3635
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(File.Import, { name: ["Infer"], path: "@kubb/swagger-ts/oas", isTypeOnly: true }),
3636
3636
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(File.Source, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Oas, { Template: Template2, name, typeName }) })
3637
3637
  ]
3638
3638
  }
@@ -3916,8 +3916,8 @@ var definePlugin = createPlugin((options) => {
3916
3916
  // src/types.ts
3917
3917
  init_esm_shims();
3918
3918
 
3919
- // src/infer/index.ts
3920
- var infer_exports = {};
3919
+ // src/oas/index.ts
3920
+ var oas_exports = {};
3921
3921
  init_esm_shims();
3922
3922
 
3923
3923
  // src/index.ts
@@ -3969,6 +3969,6 @@ react/cjs/react-jsx-runtime.development.js:
3969
3969
  *)
3970
3970
  */
3971
3971
 
3972
- export { infer_exports as Infer, src_default as default, definePlugin, pluginKey, pluginName };
3972
+ export { oas_exports as Oas, src_default as default, definePlugin, pluginKey, pluginName };
3973
3973
  //# sourceMappingURL=out.js.map
3974
3974
  //# sourceMappingURL=index.js.map