@kubb/plugin-zod 3.1.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 (57) hide show
  1. package/dist/{chunk-D2WPMTC7.cjs → chunk-27WWRYZI.cjs} +9 -5
  2. package/dist/chunk-27WWRYZI.cjs.map +1 -0
  3. package/dist/{chunk-YMVA7BZZ.js → chunk-5NJLJUON.js} +3 -3
  4. package/dist/{chunk-YMVA7BZZ.js.map → chunk-5NJLJUON.js.map} +1 -1
  5. package/dist/{chunk-NOXYTLKS.cjs → chunk-B5GU7DW3.cjs} +6 -6
  6. package/dist/{chunk-NOXYTLKS.cjs.map → chunk-B5GU7DW3.cjs.map} +1 -1
  7. package/dist/{chunk-SGDZKF6Z.js → chunk-QAVLGGME.js} +9 -5
  8. package/dist/chunk-QAVLGGME.js.map +1 -0
  9. package/dist/components.cjs +3 -3
  10. package/dist/components.js +1 -1
  11. package/dist/generators.cjs +4 -4
  12. package/dist/generators.js +2 -2
  13. package/dist/index.cjs +4 -4
  14. package/dist/index.js +2 -2
  15. package/package.json +10 -10
  16. package/src/generators/__snapshots__/anyof.ts +14 -2
  17. package/src/generators/__snapshots__/coercion.ts +13 -2
  18. package/src/generators/__snapshots__/coercionDates.ts +13 -2
  19. package/src/generators/__snapshots__/coercionNumbers.ts +13 -2
  20. package/src/generators/__snapshots__/coercionStrings.ts +13 -2
  21. package/src/generators/__snapshots__/createPet.ts +10 -7
  22. package/src/generators/__snapshots__/createPetWithUnknownTypeUnknown.ts +10 -7
  23. package/src/generators/__snapshots__/deletePet.ts +2 -2
  24. package/src/generators/__snapshots__/discriminator.ts +31 -2
  25. package/src/generators/__snapshots__/enumBooleanLiteral.ts +2 -2
  26. package/src/generators/__snapshots__/enumNamesType.ts +2 -2
  27. package/src/generators/__snapshots__/enumNullable.ts +2 -2
  28. package/src/generators/__snapshots__/enumSingleLiteral.ts +2 -2
  29. package/src/generators/__snapshots__/enumVarNamesType.ts +2 -2
  30. package/src/generators/__snapshots__/example.ts +4 -2
  31. package/src/generators/__snapshots__/getPets.ts +12 -7
  32. package/src/generators/__snapshots__/mixedValueTypeConst.ts +7 -3
  33. package/src/generators/__snapshots__/nullableString.ts +2 -2
  34. package/src/generators/__snapshots__/nullableStringUuid.ts +2 -2
  35. package/src/generators/__snapshots__/nullableStringWithAnyOf.ts +2 -2
  36. package/src/generators/__snapshots__/numberValueConst.ts +7 -3
  37. package/src/generators/__snapshots__/oneof.ts +9 -2
  38. package/src/generators/__snapshots__/operations.ts +61 -44
  39. package/src/generators/__snapshots__/optionalPetInfer.ts +7 -3
  40. package/src/generators/__snapshots__/optionalPetTyped.ts +6 -2
  41. package/src/generators/__snapshots__/order.ts +9 -2
  42. package/src/generators/__snapshots__/orderDateTypeFalse.ts +9 -2
  43. package/src/generators/__snapshots__/orderDateTypeString.ts +9 -2
  44. package/src/generators/__snapshots__/pet.ts +13 -2
  45. package/src/generators/__snapshots__/petArray.ts +7 -3
  46. package/src/generators/__snapshots__/petCoercion.ts +13 -2
  47. package/src/generators/__snapshots__/petTupleObject.ts +7 -3
  48. package/src/generators/__snapshots__/petWithMapper.ts +13 -2
  49. package/src/generators/__snapshots__/pets.ts +8 -2
  50. package/src/generators/__snapshots__/recursive.ts +5 -2
  51. package/src/generators/__snapshots__/showPetById.ts +10 -7
  52. package/src/generators/__snapshots__/stringValueConst.ts +7 -3
  53. package/src/generators/__snapshots__/toy.ts +8 -2
  54. package/src/generators/__snapshots__/uuidSchema.ts +2 -2
  55. package/src/parser/index.ts +7 -3
  56. package/dist/chunk-D2WPMTC7.cjs.map +0 -1
  57. package/dist/chunk-SGDZKF6Z.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-zod",
3
- "version": "3.1.0",
3
+ "version": "3.3.0",
4
4
  "description": "Generator plugin-zod",
5
5
  "keywords": [
6
6
  "typescript",
@@ -58,18 +58,18 @@
58
58
  "!/**/__tests__/**"
59
59
  ],
60
60
  "dependencies": {
61
- "@kubb/core": "3.1.0",
62
- "@kubb/fs": "3.1.0",
63
- "@kubb/oas": "3.1.0",
64
- "@kubb/parser-ts": "3.1.0",
65
- "@kubb/plugin-oas": "3.1.0",
66
- "@kubb/plugin-ts": "3.1.0",
67
- "@kubb/react": "3.1.0"
61
+ "@kubb/core": "3.3.0",
62
+ "@kubb/fs": "3.3.0",
63
+ "@kubb/oas": "3.3.0",
64
+ "@kubb/parser-ts": "3.3.0",
65
+ "@kubb/plugin-oas": "3.3.0",
66
+ "@kubb/plugin-ts": "3.3.0",
67
+ "@kubb/react": "3.3.0"
68
68
  },
69
69
  "devDependencies": {
70
70
  "tsup": "^8.3.5",
71
- "@kubb/config-ts": "3.1.0",
72
- "@kubb/config-tsup": "3.1.0"
71
+ "@kubb/config-ts": "3.3.0",
72
+ "@kubb/config-tsup": "3.3.0"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "@kubb/react": "^3.0.0"
@@ -1,3 +1,15 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const test = z.union([z.object({ "propertyA": z.string() }).strict(), z.object({ "propertyA": z.string(), "propertyB": z.string() }).strict()]);
3
+ export const test = z.union([
4
+ z
5
+ .object({
6
+ propertyA: z.string(),
7
+ })
8
+ .strict(),
9
+ z
10
+ .object({
11
+ propertyA: z.string(),
12
+ propertyB: z.string(),
13
+ })
14
+ .strict(),
15
+ ])
@@ -1,3 +1,14 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const pet = z.object({ "id": z.coerce.number().int(), "name": z.coerce.string(), "date": z.coerce.date().optional(), "uuid": z.coerce.string().uuid().optional(), "email": z.coerce.string().email().optional(), "pattern": z.coerce.string().regex(new RegExp("^[a-zA-Z0-9]{3}$")).optional(), "tag": z.coerce.string().min(5).max(100).optional() });
3
+ export const pet = z.object({
4
+ id: z.coerce.number().int(),
5
+ name: z.coerce.string(),
6
+ date: z.coerce.date().optional(),
7
+ uuid: z.coerce.string().uuid().optional(),
8
+ email: z.coerce.string().email().optional(),
9
+ pattern: z.coerce
10
+ .string()
11
+ .regex(/^[a-zA-Z0-9]{3}$/)
12
+ .optional(),
13
+ tag: z.coerce.string().min(5).max(100).optional(),
14
+ })
@@ -1,3 +1,14 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const pet = z.object({ "id": z.number().int(), "name": z.string(), "date": z.coerce.date().optional(), "uuid": z.string().uuid().optional(), "email": z.string().email().optional(), "pattern": z.string().regex(new RegExp("^[a-zA-Z0-9]{3}$")).optional(), "tag": z.string().min(5).max(100).optional() });
3
+ export const pet = z.object({
4
+ id: z.number().int(),
5
+ name: z.string(),
6
+ date: z.coerce.date().optional(),
7
+ uuid: z.string().uuid().optional(),
8
+ email: z.string().email().optional(),
9
+ pattern: z
10
+ .string()
11
+ .regex(/^[a-zA-Z0-9]{3}$/)
12
+ .optional(),
13
+ tag: z.string().min(5).max(100).optional(),
14
+ })
@@ -1,3 +1,14 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const pet = z.object({ "id": z.coerce.number().int(), "name": z.string(), "date": z.date().optional(), "uuid": z.string().uuid().optional(), "email": z.string().email().optional(), "pattern": z.string().regex(new RegExp("^[a-zA-Z0-9]{3}$")).optional(), "tag": z.string().min(5).max(100).optional() });
3
+ export const pet = z.object({
4
+ id: z.coerce.number().int(),
5
+ name: z.string(),
6
+ date: z.date().optional(),
7
+ uuid: z.string().uuid().optional(),
8
+ email: z.string().email().optional(),
9
+ pattern: z
10
+ .string()
11
+ .regex(/^[a-zA-Z0-9]{3}$/)
12
+ .optional(),
13
+ tag: z.string().min(5).max(100).optional(),
14
+ })
@@ -1,3 +1,14 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const pet = z.object({ "id": z.number().int(), "name": z.coerce.string(), "date": z.date().optional(), "uuid": z.coerce.string().uuid().optional(), "email": z.coerce.string().email().optional(), "pattern": z.coerce.string().regex(new RegExp("^[a-zA-Z0-9]{3}$")).optional(), "tag": z.coerce.string().min(5).max(100).optional() });
3
+ export const pet = z.object({
4
+ id: z.number().int(),
5
+ name: z.coerce.string(),
6
+ date: z.date().optional(),
7
+ uuid: z.coerce.string().uuid().optional(),
8
+ email: z.coerce.string().email().optional(),
9
+ pattern: z.coerce
10
+ .string()
11
+ .regex(/^[a-zA-Z0-9]{3}$/)
12
+ .optional(),
13
+ tag: z.coerce.string().min(5).max(100).optional(),
14
+ })
@@ -1,15 +1,18 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- /**
3
+ /**
4
4
  * @description Null response
5
5
  */
6
- export const createPets201 = z.any();
6
+ export const createPets201 = z.any()
7
7
 
8
- /**
8
+ /**
9
9
  * @description unexpected error
10
10
  */
11
- export const createPetsError = z.lazy(() => error);
11
+ export const createPetsError = z.lazy(() => error)
12
12
 
13
- export const createPetsMutationRequest = z.object({ "name": z.string(), "tag": z.string() });
13
+ export const createPetsMutationRequest = z.object({
14
+ name: z.string(),
15
+ tag: z.string(),
16
+ })
14
17
 
15
- export const createPetsMutationResponse = z.lazy(() => createPets201);
18
+ export const createPetsMutationResponse = z.lazy(() => createPets201)
@@ -1,15 +1,18 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- /**
3
+ /**
4
4
  * @description Null response
5
5
  */
6
- export const createPets201 = z.unknown();
6
+ export const createPets201 = z.unknown()
7
7
 
8
- /**
8
+ /**
9
9
  * @description unexpected error
10
10
  */
11
- export const createPetsError = z.lazy(() => error);
11
+ export const createPetsError = z.lazy(() => error)
12
12
 
13
- export const createPetsMutationRequest = z.object({ "name": z.string(), "tag": z.string() });
13
+ export const createPetsMutationRequest = z.object({
14
+ name: z.string(),
15
+ tag: z.string(),
16
+ })
14
17
 
15
- export const createPetsMutationResponse = z.lazy(() => createPets201);
18
+ export const createPetsMutationResponse = z.lazy(() => createPets201)
@@ -1,3 +1,3 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const deletePetsPetidMutationResponse = z.any();
3
+ export const deletePetsPetidMutationResponse = z.any()
@@ -1,3 +1,32 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const advanced = z.union([z.lazy(() => enumerationValueSpecificationDto).and(z.object({ "type": z.enum(["enum", "range", "regex", "slider"]) })), z.lazy(() => rangeValueSpecificationDto).and(z.object({ "type": z.enum(["enum", "range", "regex", "slider"]) })), z.lazy(() => regexValueSpecificationDto).and(z.object({ "type": z.enum(["enum", "range", "regex", "slider"]) })), z.lazy(() => sliderValueSpecificationDto).and(z.object({ "type": z.enum(["enum", "range", "regex", "slider"]) }))]);
3
+ export const advanced = z.union([
4
+ z
5
+ .lazy(() => enumerationValueSpecificationDto)
6
+ .and(
7
+ z.object({
8
+ type: z.enum(['enum', 'range', 'regex', 'slider']),
9
+ }),
10
+ ),
11
+ z
12
+ .lazy(() => rangeValueSpecificationDto)
13
+ .and(
14
+ z.object({
15
+ type: z.enum(['enum', 'range', 'regex', 'slider']),
16
+ }),
17
+ ),
18
+ z
19
+ .lazy(() => regexValueSpecificationDto)
20
+ .and(
21
+ z.object({
22
+ type: z.enum(['enum', 'range', 'regex', 'slider']),
23
+ }),
24
+ ),
25
+ z
26
+ .lazy(() => sliderValueSpecificationDto)
27
+ .and(
28
+ z.object({
29
+ type: z.enum(['enum', 'range', 'regex', 'slider']),
30
+ }),
31
+ ),
32
+ ])
@@ -1,3 +1,3 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const enumBooleanLiteral = z.union([z.literal(true), z.literal(false)]);
3
+ export const enumBooleanLiteral = z.union([z.literal(true), z.literal(false)])
@@ -1,3 +1,3 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const enumNamesType = z.enum(["0", "1"]);
3
+ export const enumNamesType = z.enum(['0', '1'])
@@ -1,3 +1,3 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const enumNullable = z.enum(["Pending", "Received"]).nullable();
3
+ export const enumNullable = z.enum(['Pending', 'Received']).nullable()
@@ -1,3 +1,3 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const enumSingleLiteral = z.literal(0);
3
+ export const enumSingleLiteral = z.literal(0)
@@ -1,3 +1,3 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const enumVarNamesType = z.union([z.literal(0), z.literal(1)]);
3
+ export const enumVarNamesType = z.union([z.literal(0), z.literal(1)])
@@ -1,3 +1,5 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const example = z.object({ "nestedExamples": z.lazy(() => example).optional() });
3
+ export const example = z.object({
4
+ nestedExamples: z.lazy(() => example).optional(),
5
+ })
@@ -1,15 +1,20 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const listPetsQueryParams = z.object({ "limit": z.string().describe("How many items to return at one time (max 100)").optional(), "offset": z.number().int().default(0) }).optional();
3
+ export const listPetsQueryParams = z
4
+ .object({
5
+ limit: z.string().describe('How many items to return at one time (max 100)').optional(),
6
+ offset: z.number().int().default(0),
7
+ })
8
+ .optional()
4
9
 
5
- /**
10
+ /**
6
11
  * @description A paged array of pets
7
12
  */
8
- export const listPets200 = z.lazy(() => pets);
13
+ export const listPets200 = z.lazy(() => pets)
9
14
 
10
- /**
15
+ /**
11
16
  * @description unexpected error
12
17
  */
13
- export const listPetsError = z.lazy(() => error);
18
+ export const listPetsError = z.lazy(() => error)
14
19
 
15
- export const listPetsQueryResponse = z.lazy(() => listPets200);
20
+ export const listPetsQueryResponse = z.lazy(() => listPets200)
@@ -1,6 +1,10 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- /**
3
+ /**
4
4
  * @description This probably should fail miserably
5
5
  */
6
- export const mixedValueTypeConst = z.object({ "foobar": z.literal("foobar") }).describe("This probably should fail miserably");
6
+ export const mixedValueTypeConst = z
7
+ .object({
8
+ foobar: z.literal('foobar'),
9
+ })
10
+ .describe('This probably should fail miserably')
@@ -1,3 +1,3 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const nullableString = z.string().nullable();
3
+ export const nullableString = z.string().nullable()
@@ -1,3 +1,3 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const nullableStringUuid = z.string().uuid().nullable();
3
+ export const nullableStringUuid = z.string().uuid().nullable()
@@ -1,3 +1,3 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const nullableStringWithAnyOf = z.union([z.string(), z.null()]);
3
+ export const nullableStringWithAnyOf = z.union([z.string(), z.null()])
@@ -1,6 +1,10 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- /**
3
+ /**
4
4
  * @description its value is equal to the value of the keyword
5
5
  */
6
- export const numberValueConst = z.object({ "foobar": z.literal(42) }).describe("its value is equal to the value of the keyword");
6
+ export const numberValueConst = z
7
+ .object({
8
+ foobar: z.literal(42),
9
+ })
10
+ .describe('its value is equal to the value of the keyword')
@@ -1,3 +1,10 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const test = z.union([z.object({ "propertyA": z.string().optional() }), z.object({ "propertyA": z.string().optional() })]);
3
+ export const test = z.union([
4
+ z.object({
5
+ propertyA: z.string().optional(),
6
+ }),
7
+ z.object({
8
+ propertyA: z.string().optional(),
9
+ }),
10
+ ])
@@ -1,46 +1,63 @@
1
- import { listPets200, listPetsQueryResponse, listPetsQueryParams, createPetsMutationRequest, createPets201, createPetsMutationResponse, showPetById200, showPetByIdQueryResponse, showPetByIdPathParams } from "./showPetById";
1
+ import {
2
+ listPets200,
3
+ listPetsQueryResponse,
4
+ listPetsQueryParams,
5
+ createPetsMutationRequest,
6
+ createPets201,
7
+ createPetsMutationResponse,
8
+ showPetById200,
9
+ showPetByIdQueryResponse,
10
+ showPetByIdPathParams,
11
+ } from './showPetById'
2
12
 
3
- export const operations = { "listPets": {
4
- request: undefined,
5
- parameters: {
6
- path: undefined,
7
- query: listPetsQueryParams,
8
- header: undefined
9
- },
10
- responses: {
11
- 200: listPets200,
12
- default: listPetsQueryResponse
13
- },
14
- errors: {}
15
- }, "createPets": {
16
- request: createPetsMutationRequest,
17
- parameters: {
18
- path: undefined,
19
- query: undefined,
20
- header: undefined
21
- },
22
- responses: {
23
- 201: createPets201,
24
- default: createPetsMutationResponse
25
- },
26
- errors: {}
27
- }, "showPetById": {
28
- request: undefined,
29
- parameters: {
30
- path: showPetByIdPathParams,
31
- query: undefined,
32
- header: undefined
33
- },
34
- responses: {
35
- 200: showPetById200,
36
- default: showPetByIdQueryResponse
37
- },
38
- errors: {}
39
- } } as const;
13
+ export const operations = {
14
+ listPets: {
15
+ request: undefined,
16
+ parameters: {
17
+ path: undefined,
18
+ query: listPetsQueryParams,
19
+ header: undefined,
20
+ },
21
+ responses: {
22
+ 200: listPets200,
23
+ default: listPetsQueryResponse,
24
+ },
25
+ errors: {},
26
+ },
27
+ createPets: {
28
+ request: createPetsMutationRequest,
29
+ parameters: {
30
+ path: undefined,
31
+ query: undefined,
32
+ header: undefined,
33
+ },
34
+ responses: {
35
+ 201: createPets201,
36
+ default: createPetsMutationResponse,
37
+ },
38
+ errors: {},
39
+ },
40
+ showPetById: {
41
+ request: undefined,
42
+ parameters: {
43
+ path: showPetByIdPathParams,
44
+ query: undefined,
45
+ header: undefined,
46
+ },
47
+ responses: {
48
+ 200: showPetById200,
49
+ default: showPetByIdQueryResponse,
50
+ },
51
+ errors: {},
52
+ },
53
+ } as const
40
54
 
41
- export const paths = { "/pets": {
42
- get: operations["listPets"],
43
- post: operations["createPets"]
44
- }, "/pets/{petId}": {
45
- get: operations["showPetById"]
46
- } } as const;
55
+ export const paths = {
56
+ '/pets': {
57
+ get: operations['listPets'],
58
+ post: operations['createPets'],
59
+ },
60
+ '/pets/{petId}': {
61
+ get: operations['showPetById'],
62
+ },
63
+ } as const
@@ -1,5 +1,9 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const optionalPet = z.object({ "id": z.number().int().optional(), "name": z.string().optional(), "tag": z.string().optional() });
3
+ export const optionalPet = z.object({
4
+ id: z.number().int().optional(),
5
+ name: z.string().optional(),
6
+ tag: z.string().optional(),
7
+ })
4
8
 
5
- export type OptionalPet = z.infer<typeof optionalPet>;
9
+ export type OptionalPet = z.infer<typeof optionalPet>
@@ -1,3 +1,7 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const optionalPet = z.object({ "id": z.number().int().optional(), "name": z.string().optional(), "tag": z.string().optional() }) as z.ZodType<OptionalPet>;
3
+ export const optionalPet = z.object({
4
+ id: z.number().int().optional(),
5
+ name: z.string().optional(),
6
+ tag: z.string().optional(),
7
+ }) as z.ZodType<OptionalPet>
@@ -1,3 +1,10 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const order = z.object({ "id": z.number().int().optional(), "petId": z.number().int().optional(), "quantity": z.number().int().optional(), "shipDate": z.date().optional(), "status": z.enum(["placed", "approved", "delivered"]).describe("Order Status").optional(), "complete": z.boolean().optional() });
3
+ export const order = z.object({
4
+ id: z.number().int().optional(),
5
+ petId: z.number().int().optional(),
6
+ quantity: z.number().int().optional(),
7
+ shipDate: z.date().optional(),
8
+ status: z.enum(['placed', 'approved', 'delivered']).describe('Order Status').optional(),
9
+ complete: z.boolean().optional(),
10
+ })
@@ -1,3 +1,10 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const order = z.object({ "id": z.number().int().optional(), "petId": z.number().int().optional(), "quantity": z.number().int().optional(), "shipDate": z.string().optional(), "status": z.enum(["placed", "approved", "delivered"]).describe("Order Status").optional(), "complete": z.boolean().optional() });
3
+ export const order = z.object({
4
+ id: z.number().int().optional(),
5
+ petId: z.number().int().optional(),
6
+ quantity: z.number().int().optional(),
7
+ shipDate: z.string().optional(),
8
+ status: z.enum(['placed', 'approved', 'delivered']).describe('Order Status').optional(),
9
+ complete: z.boolean().optional(),
10
+ })
@@ -1,3 +1,10 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const order = z.object({ "id": z.number().int().optional(), "petId": z.number().int().optional(), "quantity": z.number().int().optional(), "shipDate": z.string().datetime().optional(), "status": z.enum(["placed", "approved", "delivered"]).describe("Order Status").optional(), "complete": z.boolean().optional() });
3
+ export const order = z.object({
4
+ id: z.number().int().optional(),
5
+ petId: z.number().int().optional(),
6
+ quantity: z.number().int().optional(),
7
+ shipDate: z.string().datetime().optional(),
8
+ status: z.enum(['placed', 'approved', 'delivered']).describe('Order Status').optional(),
9
+ complete: z.boolean().optional(),
10
+ })
@@ -1,3 +1,14 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const pet = z.object({ "id": z.number().int(), "name": z.string(), "date": z.date().optional(), "uuid": z.string().uuid().optional(), "email": z.string().email().optional(), "pattern": z.string().regex(new RegExp("^[a-zA-Z0-9]{3}$")).optional(), "tag": z.string().min(5).max(100).optional() });
3
+ export const pet = z.object({
4
+ id: z.number().int(),
5
+ name: z.string(),
6
+ date: z.date().optional(),
7
+ uuid: z.string().uuid().optional(),
8
+ email: z.string().email().optional(),
9
+ pattern: z
10
+ .string()
11
+ .regex(/^[a-zA-Z0-9]{3}$/)
12
+ .optional(),
13
+ tag: z.string().min(5).max(100).optional(),
14
+ })
@@ -1,6 +1,10 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- /**
3
+ /**
4
4
  * @description List of Pet object
5
5
  */
6
- export const petArray = z.array(z.lazy(() => pet)).min(1).max(3).describe("List of Pet object");
6
+ export const petArray = z
7
+ .array(z.lazy(() => pet))
8
+ .min(1)
9
+ .max(3)
10
+ .describe('List of Pet object')
@@ -1,3 +1,14 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const pet = z.object({ "id": z.coerce.number().int(), "name": z.coerce.string(), "date": z.coerce.date().optional(), "uuid": z.coerce.string().uuid().optional(), "email": z.coerce.string().email().optional(), "pattern": z.coerce.string().regex(new RegExp("^[a-zA-Z0-9]{3}$")).optional(), "tag": z.coerce.string().min(5).max(100).optional() });
3
+ export const pet = z.object({
4
+ id: z.coerce.number().int(),
5
+ name: z.coerce.string(),
6
+ date: z.coerce.date().optional(),
7
+ uuid: z.coerce.string().uuid().optional(),
8
+ email: z.coerce.string().email().optional(),
9
+ pattern: z.coerce
10
+ .string()
11
+ .regex(/^[a-zA-Z0-9]{3}$/)
12
+ .optional(),
13
+ tag: z.coerce.string().min(5).max(100).optional(),
14
+ })
@@ -1,6 +1,10 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- /**
3
+ /**
4
4
  * @description Tuple of exact length 2 nested in an object
5
5
  */
6
- export const petTupleObject = z.object({ "tupleProperty": z.tuple([z.string(), z.string()]).optional() }).describe("Tuple of exact length 2 nested in an object");
6
+ export const petTupleObject = z
7
+ .object({
8
+ tupleProperty: z.tuple([z.string(), z.string()]).optional(),
9
+ })
10
+ .describe('Tuple of exact length 2 nested in an object')
@@ -1,3 +1,14 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const pet = z.object({ "id": z.number().int(), "name": z.string().email(), "date": z.date().optional(), "uuid": z.string().uuid().optional(), "email": z.string().email().optional(), "pattern": z.string().regex(new RegExp("^[a-zA-Z0-9]{3}$")).optional(), "tag": z.string().min(5).max(100).optional() });
3
+ export const pet = z.object({
4
+ id: z.number().int(),
5
+ name: z.string().email(),
6
+ date: z.date().optional(),
7
+ uuid: z.string().uuid().optional(),
8
+ email: z.string().email().optional(),
9
+ pattern: z
10
+ .string()
11
+ .regex(/^[a-zA-Z0-9]{3}$/)
12
+ .optional(),
13
+ tag: z.string().min(5).max(100).optional(),
14
+ })
@@ -1,3 +1,9 @@
1
- import { z } from "zod";
1
+ import { z } from 'zod'
2
2
 
3
- export const pets = z.array(z.object({ "id": z.number().int(), "name": z.string(), "tag": z.string().optional() })) as z.ZodType<Pets>;
3
+ export const pets = z.array(
4
+ z.object({
5
+ id: z.number().int(),
6
+ name: z.string(),
7
+ tag: z.string().optional(),
8
+ }),
9
+ ) as z.ZodType<Pets>