@kubb/plugin-ts 3.2.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{chunk-KFZ72XC5.cjs → chunk-2M6PDW4T.cjs} +19 -15
  2. package/dist/chunk-2M6PDW4T.cjs.map +1 -0
  3. package/dist/{chunk-OJLL42LQ.js → chunk-65CJCKDZ.js} +44 -40
  4. package/dist/chunk-65CJCKDZ.js.map +1 -0
  5. package/dist/{chunk-UE4AMVPZ.cjs → chunk-WETJULJE.cjs} +42 -39
  6. package/dist/chunk-WETJULJE.cjs.map +1 -0
  7. package/dist/{chunk-S2CJKQ76.js → chunk-Z7RYCWNL.js} +11 -7
  8. package/dist/chunk-Z7RYCWNL.js.map +1 -0
  9. package/dist/components.cjs +3 -3
  10. package/dist/components.d.cts +3 -2
  11. package/dist/components.d.ts +3 -2
  12. package/dist/components.js +1 -1
  13. package/dist/generators.cjs +4 -4
  14. package/dist/generators.d.cts +1 -1
  15. package/dist/generators.d.ts +1 -1
  16. package/dist/generators.js +2 -2
  17. package/dist/index.cjs +4 -4
  18. package/dist/index.d.cts +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +2 -2
  21. package/dist/{types-Dy6NIaQp.d.cts → types-9taMMp9y.d.cts} +6 -0
  22. package/dist/{types-Dy6NIaQp.d.ts → types-9taMMp9y.d.ts} +6 -0
  23. package/package.json +9 -9
  24. package/src/components/Type.tsx +45 -39
  25. package/src/generators/__snapshots__/bodyUploadFileApiAssetsPost.ts +5 -5
  26. package/src/generators/__snapshots__/catTypeAsConst.ts +10 -10
  27. package/src/generators/__snapshots__/createPet.ts +27 -28
  28. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +27 -28
  29. package/src/generators/__snapshots__/deletePet.ts +5 -6
  30. package/src/generators/__snapshots__/dogTypeAsConst.ts +10 -10
  31. package/src/generators/__snapshots__/enumAllOf.ts +7 -7
  32. package/src/generators/__snapshots__/enumArray.ts +12 -16
  33. package/src/generators/__snapshots__/enumInObject.ts +10 -10
  34. package/src/generators/__snapshots__/enumItems.ts +5 -5
  35. package/src/generators/__snapshots__/enumNames.ts +3 -3
  36. package/src/generators/__snapshots__/enumNamesConst.ts +3 -3
  37. package/src/generators/__snapshots__/enumNamesLiteral.ts +2 -2
  38. package/src/generators/__snapshots__/enumNamesPascalConst.ts +5 -5
  39. package/src/generators/__snapshots__/enumNamesType.ts +5 -5
  40. package/src/generators/__snapshots__/enumNullableMember.ts +5 -5
  41. package/src/generators/__snapshots__/enumNullableType.ts +5 -5
  42. package/src/generators/__snapshots__/enumString.ts +7 -7
  43. package/src/generators/__snapshots__/enumVarNamesType.ts +5 -5
  44. package/src/generators/__snapshots__/getPets.ts +19 -20
  45. package/src/generators/__snapshots__/mixedValueTypeConst.ts +6 -6
  46. package/src/generators/__snapshots__/nullConstNull.ts +4 -5
  47. package/src/generators/__snapshots__/numberValueConst.ts +6 -6
  48. package/src/generators/__snapshots__/petMapper.ts +14 -14
  49. package/src/generators/__snapshots__/petQuestionToken.ts +18 -19
  50. package/src/generators/__snapshots__/petQuestionTokenAndUndefined.ts +18 -19
  51. package/src/generators/__snapshots__/petUndefined.ts +18 -19
  52. package/src/generators/__snapshots__/pets.ts +13 -13
  53. package/src/generators/__snapshots__/petsInterface.ts +14 -0
  54. package/src/generators/__snapshots__/petsStoreAdvancedDiscriminator.ts +32 -29
  55. package/src/generators/__snapshots__/petsStoreDiscriminator.ts +10 -10
  56. package/src/generators/__snapshots__/petsStoreRef.ts +1 -1
  57. package/src/generators/__snapshots__/plainDateDate.ts +1 -1
  58. package/src/generators/__snapshots__/plainDateString.ts +1 -1
  59. package/src/generators/__snapshots__/plainEmail.ts +1 -1
  60. package/src/generators/__snapshots__/plainFile.ts +1 -1
  61. package/src/generators/__snapshots__/plainTimeDate.ts +1 -1
  62. package/src/generators/__snapshots__/plainUuid.ts +1 -1
  63. package/src/generators/__snapshots__/readOnly.ts +19 -20
  64. package/src/generators/__snapshots__/showPetById.ts +24 -25
  65. package/src/generators/__snapshots__/stringValueConst.ts +6 -6
  66. package/src/generators/typeGenerator.tsx +4 -2
  67. package/src/parser/index.ts +2 -1
  68. package/src/plugin.ts +2 -0
  69. package/src/types.ts +6 -0
  70. package/dist/chunk-KFZ72XC5.cjs.map +0 -1
  71. package/dist/chunk-OJLL42LQ.js.map +0 -1
  72. package/dist/chunk-S2CJKQ76.js.map +0 -1
  73. package/dist/chunk-UE4AMVPZ.cjs.map +0 -1
@@ -1,13 +1,13 @@
1
1
  export const enumInObjectReasonEnum2 = {
2
- "created_at": "created_at",
3
- "description": "description"
4
- } as const;
2
+ created_at: 'created_at',
3
+ description: 'description',
4
+ } as const
5
5
 
6
- export type EnumInObjectReasonEnum2 = (typeof enumInObjectReasonEnum2)[keyof typeof enumInObjectReasonEnum2];
6
+ export type EnumInObjectReasonEnum2 = (typeof enumInObjectReasonEnum2)[keyof typeof enumInObjectReasonEnum2]
7
7
 
8
- export type enumInObject = {
9
- /**
10
- * @type string | undefined
11
- */
12
- reason?: EnumInObjectReasonEnum2;
13
- };
8
+ export type enumInObject = {
9
+ /**
10
+ * @type string | undefined
11
+ */
12
+ reason?: EnumInObjectReasonEnum2
13
+ }
@@ -1,8 +1,8 @@
1
1
  export const enumItemsEnum2 = {
2
- "created_at": "created_at",
3
- "description": "description"
4
- } as const;
2
+ created_at: 'created_at',
3
+ description: 'description',
4
+ } as const
5
5
 
6
- export type EnumItemsEnum2 = (typeof enumItemsEnum2)[keyof typeof enumItemsEnum2];
6
+ export type EnumItemsEnum2 = (typeof enumItemsEnum2)[keyof typeof enumItemsEnum2]
7
7
 
8
- export type enumItems = EnumItemsEnum2[];
8
+ export type enumItems = EnumItemsEnum2[]
@@ -1,6 +1,6 @@
1
1
  export enum EnumNamesTypeEnum2 {
2
- "Pending" = 0,
3
- "Received" = 1
2
+ 'Pending' = 0,
3
+ 'Received' = 1,
4
4
  }
5
5
 
6
- export type enumNamesType = EnumNamesTypeEnum2;
6
+ export type enumNamesType = EnumNamesTypeEnum2
@@ -1,6 +1,6 @@
1
1
  export const enum EnumNamesTypeEnum2 {
2
- "Pending" = 0,
3
- "Received" = 1
2
+ 'Pending' = 0,
3
+ 'Received' = 1,
4
4
  }
5
5
 
6
- export type enumNamesType = EnumNamesTypeEnum2;
6
+ export type enumNamesType = EnumNamesTypeEnum2
@@ -1,3 +1,3 @@
1
- export type EnumNamesTypeEnum2 = 0 | 1;
1
+ export type EnumNamesTypeEnum2 = 0 | 1
2
2
 
3
- export type enumNamesType = EnumNamesTypeEnum2;
3
+ export type enumNamesType = EnumNamesTypeEnum2
@@ -1,8 +1,8 @@
1
1
  export const EnumNamesTypeEnum2 = {
2
- "Pending": 0,
3
- "Received": 1
4
- } as const;
2
+ Pending: 0,
3
+ Received: 1,
4
+ } as const
5
5
 
6
- type EnumNamesTypeEnum2 = (typeof EnumNamesTypeEnum2)[keyof typeof EnumNamesTypeEnum2];
6
+ type EnumNamesTypeEnum2 = (typeof EnumNamesTypeEnum2)[keyof typeof EnumNamesTypeEnum2]
7
7
 
8
- export type enumNamesType = EnumNamesTypeEnum2;
8
+ export type enumNamesType = EnumNamesTypeEnum2
@@ -1,8 +1,8 @@
1
1
  export const enumNamesType = {
2
- "Pending": 0,
3
- "Received": 1
4
- } as const;
2
+ Pending: 0,
3
+ Received: 1,
4
+ } as const
5
5
 
6
- export type EnumNamesTypeEnum2 = (typeof enumNamesType)[keyof typeof enumNamesType];
6
+ export type EnumNamesTypeEnum2 = (typeof enumNamesType)[keyof typeof enumNamesType]
7
7
 
8
- export type enumNamesType = EnumNamesTypeEnum2;
8
+ export type enumNamesType = EnumNamesTypeEnum2
@@ -1,8 +1,8 @@
1
1
  export const enumNullableMemberEnum2 = {
2
- "first": "first",
3
- "second": "second"
4
- } as const;
2
+ first: 'first',
3
+ second: 'second',
4
+ } as const
5
5
 
6
- export type EnumNullableMemberEnum2 = (typeof enumNullableMemberEnum2)[keyof typeof enumNullableMemberEnum2];
6
+ export type EnumNullableMemberEnum2 = (typeof enumNullableMemberEnum2)[keyof typeof enumNullableMemberEnum2]
7
7
 
8
- export type enumNullableMember = EnumNullableMemberEnum2 | null;
8
+ export type enumNullableMember = EnumNullableMemberEnum2 | null
@@ -1,8 +1,8 @@
1
1
  export const enumNullableTypeEnum2 = {
2
- "first": "first",
3
- "second": "second"
4
- } as const;
2
+ first: 'first',
3
+ second: 'second',
4
+ } as const
5
5
 
6
- export type EnumNullableTypeEnum2 = (typeof enumNullableTypeEnum2)[keyof typeof enumNullableTypeEnum2];
6
+ export type EnumNullableTypeEnum2 = (typeof enumNullableTypeEnum2)[keyof typeof enumNullableTypeEnum2]
7
7
 
8
- export type enumNullableType = EnumNullableTypeEnum2 | null;
8
+ export type enumNullableType = EnumNullableTypeEnum2 | null
@@ -1,10 +1,10 @@
1
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;
2
+ created_at: 'created_at',
3
+ description: 'description',
4
+ 'FILE.UPLOADED': 'FILE.UPLOADED',
5
+ 'FILE.DOWNLOADED': 'FILE.DOWNLOADED',
6
+ } as const
7
7
 
8
- export type EnumStringEnum2 = (typeof enumStringEnum2)[keyof typeof enumStringEnum2];
8
+ export type EnumStringEnum2 = (typeof enumStringEnum2)[keyof typeof enumStringEnum2]
9
9
 
10
- export type enumString = EnumStringEnum2;
10
+ export type enumString = EnumStringEnum2
@@ -1,8 +1,8 @@
1
1
  export const enumVarNamesTypeEnum2 = {
2
- "Pending": 0,
3
- "Received": 1
4
- } as const;
2
+ Pending: 0,
3
+ Received: 1,
4
+ } as const
5
5
 
6
- export type EnumVarNamesTypeEnum2 = (typeof enumVarNamesTypeEnum2)[keyof typeof enumVarNamesTypeEnum2];
6
+ export type EnumVarNamesTypeEnum2 = (typeof enumVarNamesTypeEnum2)[keyof typeof enumVarNamesTypeEnum2]
7
7
 
8
- export type enumVarNamesType = EnumVarNamesTypeEnum2;
8
+ export type enumVarNamesType = EnumVarNamesTypeEnum2
@@ -1,26 +1,25 @@
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
+ }
1
8
 
2
- export type ListPetsQueryParams = {
3
- /**
4
- * @description How many items to return at one time (max 100)
5
- * @type string | undefined
6
- */
7
- limit?: string;
8
- };
9
-
10
- /**
9
+ /**
11
10
  * @description A paged array of pets
12
- */
13
- export type ListPets200 = pets;
11
+ */
12
+ export type ListPets200 = pets
14
13
 
15
- /**
14
+ /**
16
15
  * @description unexpected error
17
- */
18
- export type ListPetsError = error;
16
+ */
17
+ export type ListPetsError = error
19
18
 
20
- export type ListPetsQueryResponse = listPets200;
19
+ export type ListPetsQueryResponse = listPets200
21
20
 
22
- export type listPetsQuery = {
23
- Response: listPets200;
24
- QueryParams: listPetsQueryParams;
25
- Errors: any;
26
- };
21
+ export type listPetsQuery = {
22
+ Response: listPets200
23
+ QueryParams: listPetsQueryParams
24
+ Errors: any
25
+ }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @description This probably should fail miserably
3
- */
3
+ */
4
4
  export type mixedValueTypeConst = {
5
- /**
6
- * @type number | undefined
7
- */
8
- foobar?: "foobar";
9
- };
5
+ /**
6
+ * @type number | undefined
7
+ */
8
+ foobar?: 'foobar'
9
+ }
@@ -1,7 +1,6 @@
1
-
2
- /**
1
+ /**
3
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
4
- */
3
+ */
5
4
  export type nullConst = {
6
- withoutValue?: null;
7
- };
5
+ withoutValue?: null
6
+ }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @description its value is equal to the value of the keyword
3
- */
3
+ */
4
4
  export type numberValueConst = {
5
- /**
6
- * @type number | undefined
7
- */
8
- foobar?: 42;
9
- };
5
+ /**
6
+ * @type number | undefined
7
+ */
8
+ foobar?: 42
9
+ }
@@ -1,15 +1,15 @@
1
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
- };
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
+ }
@@ -1,19 +1,18 @@
1
-
2
- export type pet = {
3
- /**
4
- * @type integer, int64
5
- */
6
- id: number;
7
- /**
8
- * @type string
9
- */
10
- name: string;
11
- /**
12
- * @type string | undefined
13
- */
14
- tag?: string;
15
- /**
16
- * @type object | undefined
17
- */
18
- category?: category;
19
- };
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
+ /**
15
+ * @type object | undefined
16
+ */
17
+ category?: category
18
+ }
@@ -1,19 +1,18 @@
1
-
2
- export type pet = {
3
- /**
4
- * @type integer, int64
5
- */
6
- id: number;
7
- /**
8
- * @type string
9
- */
10
- name: string;
11
- /**
12
- * @type string | undefined
13
- */
14
- tag?: string | undefined;
15
- /**
16
- * @type object | undefined
17
- */
18
- category?: category | undefined;
19
- };
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
+ /**
15
+ * @type object | undefined
16
+ */
17
+ category?: category | undefined
18
+ }
@@ -1,19 +1,18 @@
1
-
2
- export type pet = {
3
- /**
4
- * @type integer, int64
5
- */
6
- id: number;
7
- /**
8
- * @type string
9
- */
10
- name: string;
11
- /**
12
- * @type string | undefined
13
- */
14
- tag: string | undefined;
15
- /**
16
- * @type object | undefined
17
- */
18
- category: category | undefined;
19
- };
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
+ /**
15
+ * @type object | undefined
16
+ */
17
+ category: category | undefined
18
+ }
@@ -1,14 +1,14 @@
1
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
- }[];
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,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
+ }[]
@@ -1,31 +1,34 @@
1
+ export const advancedTypeEnum2 = {
2
+ enum: 'enum',
3
+ range: 'range',
4
+ regex: 'regex',
5
+ slider: 'slider',
6
+ } as const
1
7
 
2
- export const advancedTypeEnum2 = {
3
- "enum": "enum",
4
- "range": "range",
5
- "regex": "regex",
6
- "slider": "slider"
7
- } as const;
8
+ export type AdvancedTypeEnum2 = (typeof advancedTypeEnum2)[keyof typeof advancedTypeEnum2]
8
9
 
9
- export type AdvancedTypeEnum2 = (typeof advancedTypeEnum2)[keyof typeof advancedTypeEnum2];
10
-
11
- export type advanced = ((enumerationValueSpecificationDto & {
12
- /**
13
- * @type string
14
- */
15
- readonly type: AdvancedTypeEnum2;
16
- }) | (rangeValueSpecificationDto & {
17
- /**
18
- * @type string
19
- */
20
- readonly type: AdvancedTypeEnum2;
21
- }) | (regexValueSpecificationDto & {
22
- /**
23
- * @type string
24
- */
25
- readonly type: AdvancedTypeEnum2;
26
- }) | (sliderValueSpecificationDto & {
27
- /**
28
- * @type string
29
- */
30
- readonly type: AdvancedTypeEnum2;
31
- }));
10
+ export type advanced =
11
+ | (enumerationValueSpecificationDto & {
12
+ /**
13
+ * @type string
14
+ */
15
+ readonly type: AdvancedTypeEnum2
16
+ })
17
+ | (rangeValueSpecificationDto & {
18
+ /**
19
+ * @type string
20
+ */
21
+ readonly type: AdvancedTypeEnum2
22
+ })
23
+ | (regexValueSpecificationDto & {
24
+ /**
25
+ * @type string
26
+ */
27
+ readonly type: AdvancedTypeEnum2
28
+ })
29
+ | (sliderValueSpecificationDto & {
30
+ /**
31
+ * @type string
32
+ */
33
+ readonly type: AdvancedTypeEnum2
34
+ })
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * @description A project is an analysis project. It has a name, an id, and has a dataset
3
- */
3
+ */
4
4
  export type petstore = {
5
- /**
6
- * @type integer
7
- */
8
- id: number;
9
- /**
10
- * @type array | undefined
11
- */
12
- pets?: (cat | dog)[];
13
- };
5
+ /**
6
+ * @type integer
7
+ */
8
+ id: number
9
+ /**
10
+ * @type array | undefined
11
+ */
12
+ pets?: (cat | dog)[]
13
+ }
@@ -1 +1 @@
1
- export type pets = pet[];
1
+ export type pets = pet[]
@@ -1 +1 @@
1
- export type plainDate = Date;
1
+ export type plainDate = Date
@@ -1 +1 @@
1
- export type plainDate = string;
1
+ export type plainDate = string
@@ -1 +1 @@
1
- export type plainEmail = string;
1
+ export type plainEmail = string
@@ -1 +1 @@
1
- export type plainFile = Blob;
1
+ export type plainFile = Blob
@@ -1 +1 @@
1
- export type plainTime = Date;
1
+ export type plainTime = Date
@@ -1 +1 @@
1
- export type plainUuid = string;
1
+ export type plainUuid = string
@@ -1,20 +1,19 @@
1
-
2
- export type demo = {
3
- /**
4
- * @type integer | undefined
5
- */
6
- readonly attribute_readonly?: number;
7
- /**
8
- * @description not required
9
- * @type integer | undefined
10
- */
11
- attribute_writeOnly?: number;
12
- /**
13
- * @type integer | undefined
14
- */
15
- readonly attribute_with_ref?: attributeReadonly;
16
- /**
17
- * @type integer | undefined
18
- */
19
- attribute_with_ref_readonly?: attributeWriteOnly;
20
- };
1
+ export type demo = {
2
+ /**
3
+ * @type integer | undefined
4
+ */
5
+ readonly attribute_readonly?: number
6
+ /**
7
+ * @description not required
8
+ * @type integer | undefined
9
+ */
10
+ attribute_writeOnly?: number
11
+ /**
12
+ * @type integer | undefined
13
+ */
14
+ readonly attribute_with_ref?: attributeReadonly
15
+ /**
16
+ * @type integer | undefined
17
+ */
18
+ attribute_with_ref_readonly?: attributeWriteOnly
19
+ }