@kubb/plugin-ts 3.0.0-alpha.2 → 3.0.0-alpha.21

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.
Files changed (94) hide show
  1. package/README.md +13 -4
  2. package/dist/chunk-3IKQZT26.cjs +2541 -0
  3. package/dist/chunk-3IKQZT26.cjs.map +1 -0
  4. package/dist/chunk-CAATRNVS.js +2514 -0
  5. package/dist/chunk-CAATRNVS.js.map +1 -0
  6. package/dist/chunk-CPJWNK44.js +307 -0
  7. package/dist/chunk-CPJWNK44.js.map +1 -0
  8. package/dist/chunk-YLKAQOZ5.cjs +336 -0
  9. package/dist/chunk-YLKAQOZ5.cjs.map +1 -0
  10. package/dist/components.cjs +11 -6
  11. package/dist/components.cjs.map +1 -1
  12. package/dist/components.d.cts +14 -44
  13. package/dist/components.d.ts +14 -44
  14. package/dist/components.js +2 -10
  15. package/dist/components.js.map +1 -1
  16. package/dist/generators.cjs +17 -0
  17. package/dist/generators.cjs.map +1 -0
  18. package/dist/generators.d.cts +10 -0
  19. package/dist/generators.d.ts +10 -0
  20. package/dist/generators.js +4 -0
  21. package/dist/generators.js.map +1 -0
  22. package/dist/index.cjs +12 -4
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +4 -122
  25. package/dist/index.d.ts +4 -122
  26. package/dist/index.js +3 -8
  27. package/dist/index.js.map +1 -1
  28. package/dist/types-W01J9acJ.d.cts +106 -0
  29. package/dist/types-W01J9acJ.d.ts +106 -0
  30. package/package.json +21 -15
  31. package/src/components/OasType.tsx +11 -58
  32. package/src/components/Type.tsx +133 -0
  33. package/src/components/index.ts +1 -2
  34. package/src/generators/__snapshots__/bodyUploadFileApiAssetsPost.ts +6 -0
  35. package/src/generators/__snapshots__/catTypeAsConst.ts +11 -0
  36. package/src/generators/__snapshots__/createPet.ts +34 -0
  37. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +34 -0
  38. package/src/generators/__snapshots__/deletePet.ts +5 -0
  39. package/src/generators/__snapshots__/dogTypeAsConst.ts +11 -0
  40. package/src/generators/__snapshots__/enumAllOf.ts +10 -0
  41. package/src/generators/__snapshots__/enumArray.ts +19 -0
  42. package/src/generators/__snapshots__/enumInObject.ts +13 -0
  43. package/src/generators/__snapshots__/enumItems.ts +8 -0
  44. package/src/generators/__snapshots__/enumNames.ts +6 -0
  45. package/src/generators/__snapshots__/enumNamesConst.ts +6 -0
  46. package/src/generators/__snapshots__/enumNamesLiteral.ts +3 -0
  47. package/src/generators/__snapshots__/enumNamesPascalConst.ts +8 -0
  48. package/src/generators/__snapshots__/enumNamesType.ts +8 -0
  49. package/src/generators/__snapshots__/enumNullableMember.ts +8 -0
  50. package/src/generators/__snapshots__/enumNullableType.ts +8 -0
  51. package/src/generators/__snapshots__/enumString.ts +10 -0
  52. package/src/generators/__snapshots__/enumVarNamesType.ts +8 -0
  53. package/src/generators/__snapshots__/getPets.ts +27 -0
  54. package/src/generators/__snapshots__/mixedValueTypeConst.ts +9 -0
  55. package/src/generators/__snapshots__/nullConstNull.ts +6 -0
  56. package/src/generators/__snapshots__/numberValueConst.ts +9 -0
  57. package/src/generators/__snapshots__/petMapper.ts +15 -0
  58. package/src/generators/__snapshots__/petQuestionToken.ts +15 -0
  59. package/src/generators/__snapshots__/petQuestionTokenAndUndefined.ts +15 -0
  60. package/src/generators/__snapshots__/petUndefined.ts +15 -0
  61. package/src/generators/__snapshots__/pets.ts +14 -0
  62. package/src/generators/__snapshots__/petsStoreDiscriminator.ts +13 -0
  63. package/src/generators/__snapshots__/petsStoreRef.ts +1 -0
  64. package/src/generators/__snapshots__/plainDateDate.ts +1 -0
  65. package/src/generators/__snapshots__/plainDateString.ts +1 -0
  66. package/src/generators/__snapshots__/plainEmail.ts +1 -0
  67. package/src/generators/__snapshots__/plainFile.ts +1 -0
  68. package/src/generators/__snapshots__/plainTimeDate.ts +1 -0
  69. package/src/generators/__snapshots__/plainUuid.ts +1 -0
  70. package/src/generators/__snapshots__/showPetById.ts +32 -0
  71. package/src/generators/__snapshots__/stringValueConst.ts +9 -0
  72. package/src/generators/index.ts +2 -0
  73. package/src/generators/oasGenerator.tsx +29 -0
  74. package/src/generators/typeGenerator.tsx +200 -0
  75. package/src/parser/index.ts +2 -1
  76. package/src/plugin.ts +21 -20
  77. package/src/types.ts +9 -35
  78. package/dist/chunk-JF3PKBEA.cjs +0 -608
  79. package/dist/chunk-JF3PKBEA.cjs.map +0 -1
  80. package/dist/chunk-PU22CLWV.js +0 -608
  81. package/dist/chunk-PU22CLWV.js.map +0 -1
  82. package/dist/oas.cjs +0 -1
  83. package/dist/oas.cjs.map +0 -1
  84. package/dist/oas.d.cts +0 -1
  85. package/dist/oas.d.ts +0 -1
  86. package/dist/oas.js +0 -1
  87. package/dist/oas.js.map +0 -1
  88. package/src/OperationGenerator.tsx +0 -49
  89. package/src/SchemaGenerator.tsx +0 -31
  90. package/src/components/OperationSchema.tsx +0 -161
  91. package/src/components/Schema.tsx +0 -135
  92. package/src/components/__snapshots__/Schema/pets.ts +0 -23
  93. package/src/components/__snapshots__/Schema/showPetById.ts +0 -28
  94. package/src/oas/index.ts +0 -1
@@ -0,0 +1,133 @@
1
+ import { File } from '@kubb/react'
2
+
3
+ import transformers from '@kubb/core/transformers'
4
+ import { print } from '@kubb/parser-ts'
5
+ import * as factory from '@kubb/parser-ts/factory'
6
+ import { type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'
7
+ import { Fragment, type ReactNode } from 'react'
8
+ import type ts from 'typescript'
9
+ import { parse, typeKeywordMapper } from '../parser/index.ts'
10
+ import type { PluginTs } from '../types.ts'
11
+
12
+ type Props = {
13
+ name: string
14
+ typedName: string
15
+ tree: Array<Schema>
16
+ optionalType: PluginTs['resolvedOptions']['optionalType']
17
+ enumType: PluginTs['resolvedOptions']['enumType']
18
+ mapper: PluginTs['resolvedOptions']['mapper']
19
+ description?: string
20
+ keysToOmit?: string[]
21
+ }
22
+
23
+ export function Type({ name, typedName, tree, keysToOmit, optionalType, enumType, mapper, description }: Props): ReactNode {
24
+ const typeNodes: ts.Node[] = []
25
+
26
+ if (!tree.length) {
27
+ return ''
28
+ }
29
+
30
+ const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish)
31
+ const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable)
32
+ const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional)
33
+
34
+ let type =
35
+ (tree
36
+ .map((schema) =>
37
+ parse(undefined, schema, {
38
+ name,
39
+ typeName: typedName,
40
+ description,
41
+ keysToOmit,
42
+ optionalType,
43
+ enumType,
44
+ mapper,
45
+ }),
46
+ )
47
+ .filter(Boolean)
48
+ .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()
49
+
50
+ if (isNullable) {
51
+ type = factory.createUnionDeclaration({
52
+ nodes: [type, factory.keywordTypeNodes.null],
53
+ }) as ts.TypeNode
54
+ }
55
+
56
+ if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {
57
+ type = factory.createUnionDeclaration({
58
+ nodes: [type, factory.keywordTypeNodes.undefined],
59
+ }) as ts.TypeNode
60
+ }
61
+
62
+ if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {
63
+ type = factory.createUnionDeclaration({
64
+ nodes: [type, factory.keywordTypeNodes.undefined],
65
+ }) as ts.TypeNode
66
+ }
67
+
68
+ const node = factory.createTypeAliasDeclaration({
69
+ modifiers: [factory.modifiers.export],
70
+ name,
71
+ type: keysToOmit?.length
72
+ ? factory.createOmitDeclaration({
73
+ keys: keysToOmit,
74
+ type,
75
+ nonNullable: true,
76
+ })
77
+ : type,
78
+ })
79
+
80
+ const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum)
81
+
82
+ const enums = enumSchemas.map((enumSchema) => {
83
+ const name = enumType === 'asPascalConst' ? transformers.pascalCase(enumSchema.args.name) : transformers.camelCase(enumSchema.args.name)
84
+ const typeName = enumSchema.args.typeName
85
+
86
+ const [nameNode, typeNode] = factory.createEnumDeclaration({
87
+ name,
88
+ typeName,
89
+ enums: enumSchema.args.items
90
+ .map((item) => (item.value === undefined ? undefined : [transformers.trimQuotes(item.name?.toString()), item.value]))
91
+ .filter(Boolean) as unknown as [string, string][],
92
+ type: enumType,
93
+ })
94
+
95
+ return {
96
+ nameNode,
97
+ typeNode,
98
+ name,
99
+ typeName,
100
+ }
101
+ })
102
+
103
+ typeNodes.push(
104
+ factory.appendJSDocToNode({
105
+ node,
106
+ comments: [description ? `@description ${transformers.jsStringEscape(description)}` : undefined].filter(Boolean),
107
+ }),
108
+ )
109
+
110
+ return (
111
+ <Fragment>
112
+ {enums.map(({ name, nameNode, typeName, typeNode }, index) => (
113
+ <Fragment key={[name, nameNode].join('-')}>
114
+ {nameNode && (
115
+ <File.Source name={name} isExportable isIndexable>
116
+ {print([nameNode])}
117
+ </File.Source>
118
+ )}
119
+ {
120
+ <File.Source name={typeName} isIndexable isExportable={['enum', 'asConst', 'constEnum', 'literal', undefined].includes(enumType)} isTypeOnly>
121
+ {print([typeNode])}
122
+ </File.Source>
123
+ }
124
+ </Fragment>
125
+ ))}
126
+ {enums.every((item) => item.typeName !== name) && (
127
+ <File.Source name={typedName} isTypeOnly isExportable isIndexable>
128
+ {print(typeNodes)}
129
+ </File.Source>
130
+ )}
131
+ </Fragment>
132
+ )
133
+ }
@@ -1,3 +1,2 @@
1
1
  export { OasType } from './OasType.tsx'
2
- export { OperationSchema } from './OperationSchema.tsx'
3
- export { Schema } from './Schema.tsx'
2
+ export { Type } from './Type.tsx'
@@ -0,0 +1,6 @@
1
+ export type bodyUploadFileApiAssetsPost = {
2
+ /**
3
+ * @type string, binary
4
+ */
5
+ file: Blob;
6
+ };
@@ -0,0 +1,11 @@
1
+ export type cat = {
2
+ /**
3
+ * @type string, uuid
4
+ */
5
+ id: string;
6
+ type: "Cat";
7
+ /**
8
+ * @type boolean | undefined
9
+ */
10
+ meow?: boolean;
11
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @description Null response
3
+ */
4
+ export type CreatePets201 = (error & {
5
+ name?: errorCode;
6
+ });
7
+
8
+ /**
9
+ * @description unexpected error
10
+ */
11
+ export type CreatePetsError = error;
12
+
13
+ export type CreatePetsMutationRequest = {
14
+ /**
15
+ * @type string
16
+ */
17
+ name: string;
18
+ /**
19
+ * @type string
20
+ */
21
+ tag: string;
22
+ };
23
+
24
+ /**
25
+ * @description Null response
26
+ */
27
+ export type CreatePetsMutationResponse = (error & {
28
+ name?: errorCode;
29
+ });
30
+
31
+ export type createPetsMutation = {
32
+ Response: createPetsMutationResponse;
33
+ Request: createPetsMutationRequest;
34
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @description Null response
3
+ */
4
+ export type CreatePets201 = (error & {
5
+ name?: errorCode;
6
+ });
7
+
8
+ /**
9
+ * @description unexpected error
10
+ */
11
+ export type CreatePetsError = error;
12
+
13
+ export type CreatePetsMutationRequest = {
14
+ /**
15
+ * @type string
16
+ */
17
+ name: string;
18
+ /**
19
+ * @type string
20
+ */
21
+ tag: string;
22
+ };
23
+
24
+ /**
25
+ * @description Null response
26
+ */
27
+ export type CreatePetsMutationResponse = (error & {
28
+ name?: errorCode;
29
+ });
30
+
31
+ export type createPetsMutation = {
32
+ Response: createPetsMutationResponse;
33
+ Request: createPetsMutationRequest;
34
+ };
@@ -0,0 +1,5 @@
1
+ export type DeletePetsPetidMutationResponse = any;
2
+
3
+ export type deletePetsPetidMutation = {
4
+ Response: deletePetsPetidMutationResponse;
5
+ };
@@ -0,0 +1,11 @@
1
+ export type dog = {
2
+ /**
3
+ * @type string, uuid
4
+ */
5
+ id: string;
6
+ /**
7
+ * @type number | undefined
8
+ */
9
+ bark?: number;
10
+ type: "Dog";
11
+ };
@@ -0,0 +1,10 @@
1
+ export const enumAllOfReasonEnum2 = {
2
+ "created_at": "created_at",
3
+ "description": "description"
4
+ } as const;
5
+
6
+ export type EnumAllOfReasonEnum2 = (typeof enumAllOfReasonEnum2)[keyof typeof enumAllOfReasonEnum2];
7
+
8
+ export type enumAllOf = {
9
+ reason?: EnumAllOfReasonEnum2;
10
+ };
@@ -0,0 +1,19 @@
1
+ export const enumArrayIdentifierEnum2 = {
2
+ "NW": "NW",
3
+ "NE": "NE",
4
+ "SW": "SW",
5
+ "SE": "SE"
6
+ } as const;
7
+
8
+ export type EnumArrayIdentifierEnum2 = (typeof enumArrayIdentifierEnum2)[keyof typeof enumArrayIdentifierEnum2];
9
+
10
+ export type enumArray = {
11
+ /**
12
+ * @type array | undefined
13
+ */
14
+ identifier?: [
15
+ number,
16
+ string,
17
+ EnumArrayIdentifierEnum2
18
+ ];
19
+ };
@@ -0,0 +1,13 @@
1
+ export const enumInObjectReasonEnum2 = {
2
+ "created_at": "created_at",
3
+ "description": "description"
4
+ } as const;
5
+
6
+ export type EnumInObjectReasonEnum2 = (typeof enumInObjectReasonEnum2)[keyof typeof enumInObjectReasonEnum2];
7
+
8
+ export type enumInObject = {
9
+ /**
10
+ * @type string | undefined
11
+ */
12
+ reason?: EnumInObjectReasonEnum2;
13
+ };
@@ -0,0 +1,8 @@
1
+ export const enumItemsEnum2 = {
2
+ "created_at": "created_at",
3
+ "description": "description"
4
+ } as const;
5
+
6
+ export type EnumItemsEnum2 = (typeof enumItemsEnum2)[keyof typeof enumItemsEnum2];
7
+
8
+ export type enumItems = EnumItemsEnum2[];
@@ -0,0 +1,6 @@
1
+ export enum EnumNamesTypeEnum2 {
2
+ "Pending" = 0,
3
+ "Received" = 1
4
+ }
5
+
6
+ export type enumNamesType = EnumNamesTypeEnum2;
@@ -0,0 +1,6 @@
1
+ export const enum EnumNamesTypeEnum2 {
2
+ "Pending" = 0,
3
+ "Received" = 1
4
+ }
5
+
6
+ export type enumNamesType = EnumNamesTypeEnum2;
@@ -0,0 +1,3 @@
1
+ export type EnumNamesTypeEnum2 = 0 | 1;
2
+
3
+ export type enumNamesType = EnumNamesTypeEnum2;
@@ -0,0 +1,8 @@
1
+ export const EnumNamesTypeEnum2 = {
2
+ "Pending": 0,
3
+ "Received": 1
4
+ } as const;
5
+
6
+ type EnumNamesTypeEnum2 = (typeof EnumNamesTypeEnum2)[keyof typeof EnumNamesTypeEnum2];
7
+
8
+ export type enumNamesType = EnumNamesTypeEnum2;
@@ -0,0 +1,8 @@
1
+ export const enumNamesType = {
2
+ "Pending": 0,
3
+ "Received": 1
4
+ } as const;
5
+
6
+ export type EnumNamesTypeEnum2 = (typeof enumNamesType)[keyof typeof enumNamesType];
7
+
8
+ export type enumNamesType = EnumNamesTypeEnum2;
@@ -0,0 +1,8 @@
1
+ export const enumNullableMemberEnum2 = {
2
+ "first": "first",
3
+ "second": "second"
4
+ } as const;
5
+
6
+ export type EnumNullableMemberEnum2 = (typeof enumNullableMemberEnum2)[keyof typeof enumNullableMemberEnum2];
7
+
8
+ export type enumNullableMember = EnumNullableMemberEnum2 | null;
@@ -0,0 +1,8 @@
1
+ export const enumNullableTypeEnum2 = {
2
+ "first": "first",
3
+ "second": "second"
4
+ } as const;
5
+
6
+ export type EnumNullableTypeEnum2 = (typeof enumNullableTypeEnum2)[keyof typeof enumNullableTypeEnum2];
7
+
8
+ export type enumNullableType = EnumNullableTypeEnum2 | null;
@@ -0,0 +1,10 @@
1
+ export const enumStringEnum2 = {
2
+ "created_at": "created_at",
3
+ "description": "description",
4
+ "FILE.UPLOADED": "FILE.UPLOADED",
5
+ "FILE.DOWNLOADED": "FILE.DOWNLOADED"
6
+ } as const;
7
+
8
+ export type EnumStringEnum2 = (typeof enumStringEnum2)[keyof typeof enumStringEnum2];
9
+
10
+ export type enumString = EnumStringEnum2;
@@ -0,0 +1,8 @@
1
+ export const enumVarNamesTypeEnum2 = {
2
+ "Pending": 0,
3
+ "Received": 1
4
+ } as const;
5
+
6
+ export type EnumVarNamesTypeEnum2 = (typeof enumVarNamesTypeEnum2)[keyof typeof enumVarNamesTypeEnum2];
7
+
8
+ export type enumVarNamesType = EnumVarNamesTypeEnum2;
@@ -0,0 +1,27 @@
1
+ export type ListPetsQueryParams = {
2
+ /**
3
+ * @description How many items to return at one time (max 100)
4
+ * @type string | undefined
5
+ */
6
+ limit?: string;
7
+ };
8
+
9
+ /**
10
+ * @description A paged array of pets
11
+ */
12
+ export type ListPets200 = pets;
13
+
14
+ /**
15
+ * @description unexpected error
16
+ */
17
+ export type ListPetsError = error;
18
+
19
+ /**
20
+ * @description A paged array of pets
21
+ */
22
+ export type ListPetsQueryResponse = pets;
23
+
24
+ export type listPetsQuery = {
25
+ Response: listPetsQueryResponse;
26
+ QueryParams: listPetsQueryParams;
27
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @description This probably should fail miserably
3
+ */
4
+ export type mixedValueTypeConst = {
5
+ /**
6
+ * @type number | undefined
7
+ */
8
+ foobar?: "foobar";
9
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @description The value of this keyword MAY be null. \nUse of this keyword is functionally equivalent to an \"enum\" (Section 6.1.2) with a single value.\nAn instance validates successfully against this keyword if its value is equal to the value of the keyword.\n
3
+ */
4
+ export type nullConst = {
5
+ withoutValue?: null;
6
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @description its value is equal to the value of the keyword
3
+ */
4
+ export type numberValueConst = {
5
+ /**
6
+ * @type number | undefined
7
+ */
8
+ foobar?: 42;
9
+ };
@@ -0,0 +1,15 @@
1
+ export type pet = {
2
+ /**
3
+ * @type integer, int64
4
+ */
5
+ id: number;
6
+ /**
7
+ * @type string
8
+ */
9
+ name: string;
10
+ /**
11
+ * @type string | undefined
12
+ */
13
+ tag?: string;
14
+ category?: string;
15
+ };
@@ -0,0 +1,15 @@
1
+ export type pet = {
2
+ /**
3
+ * @type integer, int64
4
+ */
5
+ id: number;
6
+ /**
7
+ * @type string
8
+ */
9
+ name: string;
10
+ /**
11
+ * @type string | undefined
12
+ */
13
+ tag?: string;
14
+ category?: category;
15
+ };
@@ -0,0 +1,15 @@
1
+ export type pet = {
2
+ /**
3
+ * @type integer, int64
4
+ */
5
+ id: number;
6
+ /**
7
+ * @type string
8
+ */
9
+ name: string;
10
+ /**
11
+ * @type string | undefined
12
+ */
13
+ tag?: string | undefined;
14
+ category?: category | undefined;
15
+ };
@@ -0,0 +1,15 @@
1
+ export type pet = {
2
+ /**
3
+ * @type integer, int64
4
+ */
5
+ id: number;
6
+ /**
7
+ * @type string
8
+ */
9
+ name: string;
10
+ /**
11
+ * @type string | undefined
12
+ */
13
+ tag: string | undefined;
14
+ category: category | undefined;
15
+ };
@@ -0,0 +1,14 @@
1
+ export type pets = {
2
+ /**
3
+ * @type integer, int64
4
+ */
5
+ id: number;
6
+ /**
7
+ * @type string
8
+ */
9
+ name: string;
10
+ /**
11
+ * @type string | undefined
12
+ */
13
+ tag?: string;
14
+ }[];
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @description A project is an analysis project. It has a name, an id, and has a dataset
3
+ */
4
+ export type petstore = {
5
+ /**
6
+ * @type integer
7
+ */
8
+ id: number;
9
+ /**
10
+ * @type array | undefined
11
+ */
12
+ pets?: (cat | dog)[];
13
+ };
@@ -0,0 +1 @@
1
+ export type pets = pet[];
@@ -0,0 +1 @@
1
+ export type plainDate = Date;
@@ -0,0 +1 @@
1
+ export type plainDate = string;
@@ -0,0 +1 @@
1
+ export type plainEmail = string;
@@ -0,0 +1 @@
1
+ export type plainFile = Blob;
@@ -0,0 +1 @@
1
+ export type plainTime = Date;
@@ -0,0 +1 @@
1
+ export type plainUuid = string;
@@ -0,0 +1,32 @@
1
+ export type ShowPetByIdPathParams = {
2
+ /**
3
+ * @description The id of the pet to retrieve
4
+ * @type string
5
+ */
6
+ petId: string;
7
+ /**
8
+ * @description The id of the pet to retrieve
9
+ * @type string
10
+ */
11
+ testId: string;
12
+ };
13
+
14
+ /**
15
+ * @description Expected response to a valid request
16
+ */
17
+ export type ShowPetById200 = pet;
18
+
19
+ /**
20
+ * @description unexpected error
21
+ */
22
+ export type ShowPetByIdError = error;
23
+
24
+ /**
25
+ * @description Expected response to a valid request
26
+ */
27
+ export type ShowPetByIdQueryResponse = pet;
28
+
29
+ export type showPetByIdQuery = {
30
+ Response: showPetByIdQueryResponse;
31
+ PathParams: showPetByIdPathParams;
32
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @description its value is equal to the value of the keyword
3
+ */
4
+ export type stringValueConst = {
5
+ /**
6
+ * @type string | undefined
7
+ */
8
+ foobar?: "foobar";
9
+ };
@@ -0,0 +1,2 @@
1
+ export { typeGenerator } from './typeGenerator.tsx'
2
+ export { oasGenerator } from './oasGenerator.tsx'
@@ -0,0 +1,29 @@
1
+ import { createReactGenerator } from '@kubb/plugin-oas'
2
+ import { useOas } from '@kubb/plugin-oas/hooks'
3
+ import { File, useApp } from '@kubb/react'
4
+ import { OasType } from '../components'
5
+ import type { PluginTs } from '../types.ts'
6
+
7
+ export const oasGenerator = createReactGenerator<PluginTs>({
8
+ name: 'oas',
9
+ Operations() {
10
+ const {
11
+ pluginManager,
12
+ plugin: {
13
+ options: { output },
14
+ key: pluginKey,
15
+ },
16
+ } = useApp<PluginTs>()
17
+ const oas = useOas()
18
+
19
+ const file = pluginManager.getFile({ name: 'oas', extName: '.ts', pluginKey })
20
+
21
+ return (
22
+ <File baseName={file.baseName} path={file.path} meta={file.meta} banner={output?.banner} footer={output?.footer}>
23
+ <File.Import name={['Infer']} path="@kubb/oas" isTypeOnly />
24
+
25
+ <OasType name={'oas'} typeName={'Oas'} api={oas.api} />
26
+ </File>
27
+ )
28
+ },
29
+ })