@miroir-framework/jzod-ts 0.5.2 → 0.5.3

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.
@@ -6,7 +6,7 @@ const jzodRootSchema = z.object({
6
6
  type JzodRoot = z.infer<typeof jzodRootSchema>;
7
7
 
8
8
  // ##############################################################################################################
9
- export const jzodEnumAttributeTypesSchema = z.enum([
9
+ export const jzodEnumAttributeTypes = z.enum([
10
10
  "any",
11
11
  "bigint",
12
12
  "boolean",
@@ -21,10 +21,10 @@ export const jzodEnumAttributeTypesSchema = z.enum([
21
21
  "void",
22
22
  ])
23
23
 
24
- export type JzodEnumTypes = z.infer<typeof jzodEnumAttributeTypesSchema>;
24
+ export type JzodEnumTypes = z.infer<typeof jzodEnumAttributeTypes>;
25
25
 
26
26
  // ##############################################################################################################
27
- export const jzodEnumElementTypesSchema = z.enum([
27
+ export const jzodEnumElementTypes = z.enum([
28
28
  "array",
29
29
  "enum",
30
30
  "function",
@@ -42,7 +42,7 @@ export const jzodEnumElementTypesSchema = z.enum([
42
42
  "union",
43
43
  ])
44
44
 
45
- export type JzodEnumElementTypes = z.infer<typeof jzodEnumElementTypesSchema>;
45
+ export type JzodEnumElementTypes = z.infer<typeof jzodEnumElementTypes>;
46
46
 
47
47
 
48
48
  // ##############################################################################################################
@@ -54,16 +54,16 @@ export interface JzodArray extends JzodRoot {
54
54
  definition: JzodElement
55
55
  }
56
56
 
57
- export const jzodArraySchema: z.ZodType<JzodArray> = z.object({ // issue with JsonSchema conversion when using extend from ZodRootSchema, although the 2 are functionnaly equivalent
57
+ export const jzodArray: z.ZodType<JzodArray> = z.object({ // issue with JsonSchema conversion when using extend from ZodRootSchema, although the 2 are functionnaly equivalent
58
58
  optional: z.boolean().optional(),
59
59
  nullable: z.boolean().optional(),
60
60
  extra: z.record(z.string(),z.any()).optional(),
61
61
  type: z.literal('array'),
62
- definition: z.lazy(()=>jzodElementSchema)
62
+ definition: z.lazy(()=>jzodElement)
63
63
  }).strict();
64
64
 
65
65
  // ##############################################################################################################
66
- export const jzodAttributeDateValidationsSchema = z
66
+ export const jzodAttributeDateValidations = z
67
67
  .object({
68
68
  extra: z.record(z.string(), z.any()).optional(),
69
69
  type: z.enum([
@@ -74,10 +74,10 @@ export const jzodAttributeDateValidationsSchema = z
74
74
  })
75
75
  .strict();
76
76
 
77
- export type JzodAttributeDateValidations = z.infer<typeof jzodAttributeDateValidationsSchema>;
77
+ export type JzodAttributeDateValidations = z.infer<typeof jzodAttributeDateValidations>;
78
78
 
79
79
  // ##############################################################################################################
80
- export const jzodAttributeNumberValidationsSchema = z
80
+ export const jzodAttributeNumberValidations = z
81
81
  .object({
82
82
  extra: z.record(z.string(), z.any()).optional(),
83
83
  type: z.enum([
@@ -98,10 +98,10 @@ export const jzodAttributeNumberValidationsSchema = z
98
98
  })
99
99
  .strict();
100
100
 
101
- export type JzodAttributeNumberValidations = z.infer<typeof jzodAttributeNumberValidationsSchema>;
101
+ export type JzodAttributeNumberValidations = z.infer<typeof jzodAttributeNumberValidations>;
102
102
 
103
103
  // ##############################################################################################################
104
- export const jzodAttributeStringValidationsSchema = z
104
+ export const jzodAttributeStringValidations = z
105
105
  .object({
106
106
  extra: z.record(z.string(), z.any()).optional(),
107
107
  type: z.enum([
@@ -126,58 +126,58 @@ export const jzodAttributeStringValidationsSchema = z
126
126
  })
127
127
  .strict();
128
128
 
129
- export type JzodAttributeStringValidations = z.infer<typeof jzodAttributeStringValidationsSchema>;
129
+ export type JzodAttributeStringValidations = z.infer<typeof jzodAttributeStringValidations>;
130
130
 
131
131
  // ##############################################################################################################
132
- export const jzodAttributeDateWithValidationsSchema = z.object({
132
+ export const jzodAttributeDateWithValidations = z.object({
133
133
  optional: z.boolean().optional(),
134
134
  nullable: z.boolean().optional(),
135
135
  extra: z.record(z.string(),z.any()).optional(),
136
136
  coerce: z.boolean().optional(),
137
- type: z.literal(jzodEnumElementTypesSchema.enum.simpleType),
138
- definition: z.literal(jzodEnumAttributeTypesSchema.enum.date),
139
- validations: z.array(jzodAttributeDateValidationsSchema),
137
+ type: z.literal(jzodEnumElementTypes.enum.simpleType),
138
+ definition: z.literal(jzodEnumAttributeTypes.enum.date),
139
+ validations: z.array(jzodAttributeDateValidations),
140
140
  }).strict();
141
141
 
142
- export type JzodAttributeDateWithValidations = z.infer<typeof jzodAttributeDateWithValidationsSchema>;
142
+ export type JzodAttributeDateWithValidations = z.infer<typeof jzodAttributeDateWithValidations>;
143
143
 
144
144
  // ##############################################################################################################
145
- export const jzodAttributeNumberWithValidationsSchema = z.object({
145
+ export const jzodAttributeNumberWithValidations = z.object({
146
146
  optional: z.boolean().optional(),
147
147
  nullable: z.boolean().optional(),
148
148
  extra: z.record(z.string(),z.any()).optional(),
149
149
  coerce: z.boolean().optional(),
150
- type: z.literal(jzodEnumElementTypesSchema.enum.simpleType),
151
- definition: z.literal(jzodEnumAttributeTypesSchema.enum.number),
152
- validations: z.array(jzodAttributeNumberValidationsSchema),
150
+ type: z.literal(jzodEnumElementTypes.enum.simpleType),
151
+ definition: z.literal(jzodEnumAttributeTypes.enum.number),
152
+ validations: z.array(jzodAttributeNumberValidations),
153
153
  }).strict();
154
154
 
155
- export type JzodAttributeNumberWithValidations = z.infer<typeof jzodAttributeNumberWithValidationsSchema>;
155
+ export type JzodAttributeNumberWithValidations = z.infer<typeof jzodAttributeNumberWithValidations>;
156
156
 
157
157
  // ##############################################################################################################
158
- export const jzodAttributeStringWithValidationsSchema = z.object({
158
+ export const jzodAttributeStringWithValidations = z.object({
159
159
  optional: z.boolean().optional(),
160
160
  nullable: z.boolean().optional(),
161
161
  extra: z.record(z.string(),z.any()).optional(),
162
162
  coerce: z.boolean().optional(),
163
- type: z.literal(jzodEnumElementTypesSchema.enum.simpleType),
164
- definition: z.literal(jzodEnumAttributeTypesSchema.enum.string),
165
- validations: z.array(jzodAttributeStringValidationsSchema),
163
+ type: z.literal(jzodEnumElementTypes.enum.simpleType),
164
+ definition: z.literal(jzodEnumAttributeTypes.enum.string),
165
+ validations: z.array(jzodAttributeStringValidations),
166
166
  }).strict();
167
167
 
168
- export type JzodAttributeStringWithValidations = z.infer<typeof jzodAttributeStringWithValidationsSchema>;
168
+ export type JzodAttributeStringWithValidations = z.infer<typeof jzodAttributeStringWithValidations>;
169
169
 
170
170
  // ##############################################################################################################
171
- export const jzodAttributeSchema = z.object({
171
+ export const jzodAttribute = z.object({
172
172
  optional: z.boolean().optional(),
173
173
  nullable: z.boolean().optional(),
174
174
  extra: z.record(z.string(),z.any()).optional(),
175
175
  coerce: z.boolean().optional(),
176
- type: z.literal(jzodEnumElementTypesSchema.enum.simpleType),
177
- definition: z.lazy(()=>jzodEnumAttributeTypesSchema),
176
+ type: z.literal(jzodEnumElementTypes.enum.simpleType),
177
+ definition: z.lazy(()=>jzodEnumAttributeTypes),
178
178
  }).strict();
179
179
 
180
- export type JzodAttribute = z.infer<typeof jzodAttributeSchema>;
180
+ export type JzodAttribute = z.infer<typeof jzodAttribute>;
181
181
 
182
182
 
183
183
  // ##############################################################################################################
@@ -202,41 +202,41 @@ export type JzodElement =
202
202
  | JzodUnion
203
203
  ;
204
204
 
205
- export const jzodElementSchema: z.ZodType<JzodElement> = z.union([
206
- z.lazy(()=>jzodArraySchema),
207
- z.lazy(()=>jzodAttributeSchema),
208
- z.lazy(()=>jzodAttributeDateWithValidationsSchema),
209
- z.lazy(()=>jzodAttributeNumberWithValidationsSchema),
210
- z.lazy(()=>jzodAttributeStringWithValidationsSchema),
211
- z.lazy(()=>jzodEnumSchema),
212
- z.lazy(()=>jzodFunctionSchema),
213
- z.lazy(()=>jzodLazySchema),
214
- z.lazy(()=>jzodLiteralSchema),
215
- z.lazy(()=>jzodIntersectionSchema),
205
+ export const jzodElement: z.ZodType<JzodElement> = z.union([
206
+ z.lazy(()=>jzodArray),
207
+ z.lazy(()=>jzodAttribute),
208
+ z.lazy(()=>jzodAttributeDateWithValidations),
209
+ z.lazy(()=>jzodAttributeNumberWithValidations),
210
+ z.lazy(()=>jzodAttributeStringWithValidations),
211
+ z.lazy(()=>jzodEnum),
212
+ z.lazy(()=>jzodFunction),
213
+ z.lazy(()=>jzodLazy),
214
+ z.lazy(()=>jzodLiteral),
215
+ z.lazy(()=>jzodIntersection),
216
216
  z.lazy(()=>jzodMapSchema),
217
- z.lazy(()=>jzodObjectSchema),
218
- z.lazy(()=>jzodPromiseSchema),
219
- z.lazy(()=>jzodRecordSchema),
220
- z.lazy(()=>jzodReferenceSchema),
221
- z.lazy(()=>jzodSetSchema),
222
- z.lazy(()=>jzodTupleSchema),
223
- z.lazy(()=>jzodUnionSchema),
217
+ z.lazy(()=>jzodObject),
218
+ z.lazy(()=>jzodPromise),
219
+ z.lazy(()=>jzodRecord),
220
+ z.lazy(()=>jzodReference),
221
+ z.lazy(()=>jzodSet),
222
+ z.lazy(()=>jzodTuple),
223
+ z.lazy(()=>jzodUnion),
224
224
  ])
225
225
 
226
226
  // // ##############################################################################################################
227
- // export const jzodElementSetSchema = z.record(z.string(),jzodElementSchema);
227
+ // export const jzodElementSetSchema = z.record(z.string(),jzodElement);
228
228
  // export type JzodElementSet = z.infer<typeof jzodElementSetSchema>;
229
229
 
230
230
  // ##############################################################################################################
231
- export const jzodEnumSchema = z.object({
231
+ export const jzodEnum = z.object({
232
232
  optional: z.boolean().optional(),
233
233
  nullable: z.boolean().optional(),
234
234
  extra: z.record(z.string(),z.any()).optional(),
235
- type: z.literal(jzodEnumElementTypesSchema.enum.enum),
235
+ type: z.literal(jzodEnumElementTypes.enum.enum),
236
236
  definition: z.array(z.string()),
237
237
  }).strict();
238
238
 
239
- export type JzodEnum = z.infer<typeof jzodEnumSchema>;
239
+ export type JzodEnum = z.infer<typeof jzodEnum>;
240
240
 
241
241
  // ##############################################################################################################
242
242
  export interface JzodFunction {
@@ -246,35 +246,35 @@ export interface JzodFunction {
246
246
  type: 'function',
247
247
  definition: {args: JzodElement[], returns?: JzodElement},
248
248
  }
249
- export const jzodFunctionSchema: ZodType<JzodFunction> = z.object({
250
- type: z.literal(jzodEnumElementTypesSchema.enum.function),
249
+ export const jzodFunction: ZodType<JzodFunction> = z.object({
250
+ type: z.literal(jzodEnumElementTypes.enum.function),
251
251
  extra: z.record(z.string(),z.any()).optional(),
252
252
  // anyway, arg and returns types are not use upon validation to check the function's interface. Suffices for it to be a function, it is then valid.
253
253
  definition: z.object({
254
- args:z.array(jzodElementSchema),
255
- returns: jzodElementSchema.optional(),
254
+ args:z.array(jzodElement),
255
+ returns: jzodElement.optional(),
256
256
  })
257
257
  }).strict();
258
258
 
259
259
  // ##############################################################################################################
260
- export const jzodLazySchema = z.object({
261
- type: z.literal(jzodEnumElementTypesSchema.enum.lazy),
260
+ export const jzodLazy = z.object({
261
+ type: z.literal(jzodEnumElementTypes.enum.lazy),
262
262
  extra: z.record(z.string(),z.any()).optional(),
263
- definition: jzodFunctionSchema,
263
+ definition: jzodFunction,
264
264
  }).strict();
265
265
 
266
- export type JzodLazy = z.infer<typeof jzodLazySchema>;
266
+ export type JzodLazy = z.infer<typeof jzodLazy>;
267
267
 
268
268
  // ##############################################################################################################
269
- export const jzodLiteralSchema = z.object({
269
+ export const jzodLiteral = z.object({
270
270
  optional: z.boolean().optional(),
271
271
  nullable: z.boolean().optional(),
272
272
  extra: z.record(z.string(),z.any()).optional(),
273
- type: z.literal(jzodEnumElementTypesSchema.enum.literal),
273
+ type: z.literal(jzodEnumElementTypes.enum.literal),
274
274
  definition: z.string(),
275
275
  }).strict();
276
276
 
277
- export type JzodLiteral = z.infer<typeof jzodLiteralSchema>;
277
+ export type JzodLiteral = z.infer<typeof jzodLiteral>;
278
278
 
279
279
  // ##############################################################################################################
280
280
  export interface JzodIntersection {
@@ -285,12 +285,12 @@ export interface JzodIntersection {
285
285
  definition: {left: JzodElement, right: JzodElement},
286
286
  }
287
287
 
288
- export const jzodIntersectionSchema: z.ZodType<JzodIntersection> = z.object({
288
+ export const jzodIntersection: z.ZodType<JzodIntersection> = z.object({
289
289
  optional: z.boolean().optional(),
290
290
  nullable: z.boolean().optional(),
291
291
  extra: z.record(z.string(),z.any()).optional(),
292
- type: z.literal(jzodEnumElementTypesSchema.enum.intersection),
293
- definition: z.lazy(()=>z.object({left: jzodElementSchema, right: jzodElementSchema}))
292
+ type: z.literal(jzodEnumElementTypes.enum.intersection),
293
+ definition: z.lazy(()=>z.object({left: jzodElement, right: jzodElement}))
294
294
  }).strict();
295
295
 
296
296
  // ##############################################################################################################
@@ -307,7 +307,7 @@ export const jzodMapSchema: z.ZodType<JzodMap> = z.object({ // issue with JsonSc
307
307
  nullable: z.boolean().optional(),
308
308
  extra: z.record(z.string(),z.any()).optional(),
309
309
  type: z.literal('map'),
310
- definition: z.lazy(()=>z.tuple([jzodElementSchema, jzodElementSchema]))
310
+ definition: z.lazy(()=>z.tuple([jzodElement, jzodElement]))
311
311
  }).strict();
312
312
 
313
313
  // ##############################################################################################################
@@ -322,14 +322,14 @@ export interface JzodObject extends JzodRoot {
322
322
  definition: {[attributeName:string]: JzodElement}
323
323
  }
324
324
 
325
- export const jzodObjectSchema: z.ZodType<JzodObject> = z.object({
325
+ export const jzodObject: z.ZodType<JzodObject> = z.object({
326
326
  optional: z.boolean().optional(),
327
327
  nullable: z.boolean().optional(),
328
- extend: z.lazy(()=>z.union([jzodReferenceSchema,jzodObjectSchema])).optional(),
328
+ extend: z.lazy(()=>z.union([jzodReference,jzodObject])).optional(),
329
329
  extra: z.record(z.string(),z.any()).optional(),
330
- type: z.literal(jzodEnumElementTypesSchema.enum.object),
330
+ type: z.literal(jzodEnumElementTypes.enum.object),
331
331
  nonStrict: z.boolean().optional(),
332
- definition: z.lazy(()=>z.record(z.string(),jzodElementSchema)),
332
+ definition: z.lazy(()=>z.record(z.string(),jzodElement)),
333
333
  }).strict();
334
334
 
335
335
  // ##############################################################################################################
@@ -341,12 +341,12 @@ export interface JzodPromise extends JzodRoot {
341
341
  definition: JzodElement
342
342
  }
343
343
 
344
- export const jzodPromiseSchema: z.ZodType<JzodPromise> = z.object({ // issue with JsonSchema conversion when using extend from ZodRootSchema, although the 2 are functionnaly equivalent
344
+ export const jzodPromise: z.ZodType<JzodPromise> = z.object({ // issue with JsonSchema conversion when using extend from ZodRootSchema, although the 2 are functionnaly equivalent
345
345
  // optional: z.boolean().optional(),
346
346
  // nullable: z.boolean().optional(),
347
347
  extra: z.record(z.string(),z.any()).optional(),
348
348
  type: z.literal('promise'),
349
- definition: z.lazy(()=>jzodElementSchema)
349
+ definition: z.lazy(()=>jzodElement)
350
350
  }).strict();
351
351
 
352
352
 
@@ -359,12 +359,12 @@ export interface JzodRecord {
359
359
  definition: JzodElement,
360
360
  }
361
361
 
362
- export const jzodRecordSchema: z.ZodType<JzodRecord> = z.object({
362
+ export const jzodRecord: z.ZodType<JzodRecord> = z.object({
363
363
  optional: z.boolean().optional(),
364
364
  nullable: z.boolean().optional(),
365
365
  extra: z.record(z.string(),z.any()).optional(),
366
- type: z.literal(jzodEnumElementTypesSchema.enum.record),
367
- definition: z.lazy(()=>jzodElementSchema)
366
+ type: z.literal(jzodEnumElementTypes.enum.record),
367
+ definition: z.lazy(()=>jzodElement)
368
368
  }).strict();
369
369
 
370
370
  // ##############################################################################################################
@@ -381,12 +381,12 @@ export interface JzodReference {
381
381
  },
382
382
  }
383
383
 
384
- export const jzodReferenceSchema: ZodType<JzodReference> = z.object({ // inheritance from ZodRootSchema leads to a different JsonSchema thus invalidates tests, although it is semantically equivalent
384
+ export const jzodReference: ZodType<JzodReference> = z.object({ // inheritance from ZodRootSchema leads to a different JsonSchema thus invalidates tests, although it is semantically equivalent
385
385
  optional: z.boolean().optional(),
386
386
  nullable: z.boolean().optional(),
387
387
  extra: z.record(z.string(),z.any()).optional(),
388
- type: z.literal(jzodEnumElementTypesSchema.enum.schemaReference),
389
- context: z.lazy(()=>z.record(z.string(),jzodElementSchema)).optional(),
388
+ type: z.literal(jzodEnumElementTypes.enum.schemaReference),
389
+ context: z.lazy(()=>z.record(z.string(),jzodElement)).optional(),
390
390
  definition: z.object({
391
391
  eager: z.boolean().optional(),
392
392
  relativePath: z.string().optional(),
@@ -394,7 +394,7 @@ export const jzodReferenceSchema: ZodType<JzodReference> = z.object({ // inherit
394
394
  })
395
395
  }).strict()
396
396
 
397
- // export type JzodReference = z.infer<typeof jzodReferenceSchema>;
397
+ // export type JzodReference = z.infer<typeof jzodReference>;
398
398
 
399
399
  // ##############################################################################################################
400
400
  export interface JzodSet extends JzodRoot {
@@ -405,12 +405,12 @@ export interface JzodSet extends JzodRoot {
405
405
  definition: JzodElement
406
406
  }
407
407
 
408
- export const jzodSetSchema: z.ZodType<JzodSet> = z.object({ // issue with JsonSchema conversion when using extend from ZodRootSchema, although the 2 are functionnaly equivalent
408
+ export const jzodSet: z.ZodType<JzodSet> = z.object({ // issue with JsonSchema conversion when using extend from ZodRootSchema, although the 2 are functionnaly equivalent
409
409
  optional: z.boolean().optional(),
410
410
  nullable: z.boolean().optional(),
411
411
  extra: z.record(z.string(),z.any()).optional(),
412
412
  type: z.literal('set'),
413
- definition: z.lazy(()=>jzodElementSchema)
413
+ definition: z.lazy(()=>jzodElement)
414
414
  }).strict();
415
415
 
416
416
  // ##############################################################################################################
@@ -422,12 +422,12 @@ export interface JzodTuple {
422
422
  definition: JzodElement[],
423
423
  }
424
424
 
425
- export const jzodTupleSchema: z.ZodType<JzodTuple> = z.object({
425
+ export const jzodTuple: z.ZodType<JzodTuple> = z.object({
426
426
  optional: z.boolean().optional(),
427
427
  nullable: z.boolean().optional(),
428
428
  extra: z.record(z.string(),z.any()).optional(),
429
- type: z.literal(jzodEnumElementTypesSchema.enum.tuple),
430
- definition: z.array(jzodElementSchema),
429
+ type: z.literal(jzodEnumElementTypes.enum.tuple),
430
+ definition: z.array(jzodElement),
431
431
  }).strict();
432
432
 
433
433
  // ##############################################################################################################
@@ -439,12 +439,12 @@ export interface JzodUnion {
439
439
  discriminator?: string,
440
440
  definition: JzodElement[],
441
441
  }
442
- export const jzodUnionSchema: z.ZodType<JzodUnion> = z.object({
442
+ export const jzodUnion: z.ZodType<JzodUnion> = z.object({
443
443
  optional: z.boolean().optional(),
444
444
  nullable: z.boolean().optional(),
445
445
  extra: z.record(z.string(),z.any()).optional(),
446
- type: z.literal(jzodEnumElementTypesSchema.enum.union),
446
+ type: z.literal(jzodEnumElementTypes.enum.union),
447
447
  discriminator: z.string().optional(),
448
- definition: z.lazy(()=>z.array(jzodElementSchema))
448
+ definition: z.lazy(()=>z.array(jzodElement))
449
449
  }).strict();
450
450
 
package/src/index.ts CHANGED
@@ -8,30 +8,30 @@ export { printTsTypeAlias, printTsTypeAliases } from "./tools";
8
8
 
9
9
  export {
10
10
  // SCHEMAS (const)
11
- jzodArraySchema,
12
- jzodAttributeSchema,
13
- jzodAttributeDateValidationsSchema,
14
- jzodAttributeDateWithValidationsSchema,
15
- jzodAttributeNumberValidationsSchema,
16
- jzodAttributeNumberWithValidationsSchema,
17
- jzodAttributeStringValidationsSchema,
18
- jzodAttributeStringWithValidationsSchema,
19
- jzodElementSchema,
20
- jzodEnumAttributeTypesSchema,
21
- jzodEnumElementTypesSchema,
22
- jzodEnumSchema,
23
- jzodFunctionSchema,
24
- jzodIntersectionSchema,
25
- jzodLazySchema,
26
- jzodLiteralSchema,
11
+ jzodArray,
12
+ jzodAttribute,
13
+ jzodAttributeDateValidations,
14
+ jzodAttributeDateWithValidations,
15
+ jzodAttributeNumberValidations,
16
+ jzodAttributeNumberWithValidations,
17
+ jzodAttributeStringValidations,
18
+ jzodAttributeStringWithValidations,
19
+ jzodElement,
20
+ jzodEnumAttributeTypes,
21
+ jzodEnumElementTypes,
22
+ jzodEnum,
23
+ jzodFunction,
24
+ jzodIntersection,
25
+ jzodLazy,
26
+ jzodLiteral,
27
27
  jzodMapSchema,
28
- jzodObjectSchema,
29
- jzodPromiseSchema,
30
- jzodRecordSchema,
31
- jzodReferenceSchema,
32
- jzodSetSchema,
33
- jzodTupleSchema,
34
- jzodUnionSchema,
28
+ jzodObject,
29
+ jzodPromise,
30
+ jzodRecord,
31
+ jzodReference,
32
+ jzodSet,
33
+ jzodTuple,
34
+ jzodUnion,
35
35
  // TYPES
36
36
  JzodArray,
37
37
  JzodAttribute,
@@ -3,7 +3,7 @@ import * as path from "path";
3
3
 
4
4
  import { jzodBootstrapElementSchema } from "@miroir-framework/jzod";
5
5
  import { jzodToTsCode } from "../src/JzodToTs";
6
- import { JzodElement, jzodElementSchema } from "../src/JzodTsInterface";
6
+ import { JzodElement, jzodElement } from "../src/JzodTsInterface";
7
7
 
8
8
  const refsPath = "./tests/resources"
9
9
  const tmpPath = "./tests/tmp";
@@ -84,7 +84,7 @@ describe(
84
84
  ...jzodBootstrapElementSchema.context,
85
85
  a: {
86
86
  type: "array",
87
- definition: { type: "schemaReference", definition: {relativePath: "jzodArraySchema"} }
87
+ definition: { type: "schemaReference", definition: {relativePath: "jzodArray"} }
88
88
  }
89
89
  },
90
90
  definition: {
@@ -1,5 +1,5 @@
1
1
  import { ZodType, ZodTypeAny, z } from "zod";
2
2
 
3
- export type testJzodSchema1 = string;
3
+ export type TestJzodSchema1 = string;
4
4
 
5
- export const testJzodSchema1: z.ZodType<testJzodSchema1> = z.string();
5
+ export const testJzodSchema1: z.ZodType<TestJzodSchema1> = z.string();
@@ -1,11 +1,11 @@
1
1
  import { ZodType, ZodTypeAny, z } from "zod";
2
2
 
3
- export type a = string;
4
- export type b = {
5
- test?: a;
3
+ export type A = string;
4
+ export type B = {
5
+ test?: A;
6
6
  };
7
- export type testJzodSchema2 = b;
7
+ export type TestJzodSchema2 = B;
8
8
 
9
- export const a:z.ZodType<a> = z.string();
10
- export const b:z.ZodType<b> = z.object({test:z.lazy(() =>a),}).strict();
11
- export const testJzodSchema2: z.ZodType<testJzodSchema2> = z.lazy(() =>b);
9
+ export const a:z.ZodType<A> = z.string();
10
+ export const b:z.ZodType<B> = z.object({test:z.lazy(() =>a),}).strict();
11
+ export const testJzodSchema2: z.ZodType<TestJzodSchema2> = z.lazy(() =>b);
@@ -1,7 +1,7 @@
1
1
  import { ZodType, ZodTypeAny, z } from "zod";
2
2
 
3
3
 
4
- type jzodLiteralSchema = {
4
+ type jzodLiteral = {
5
5
  optional?: boolean | undefined;
6
6
  extra?: {
7
7
  [x: string]: any;
@@ -9,11 +9,11 @@ type jzodLiteralSchema = {
9
9
  type: "literal";
10
10
  definition: string;
11
11
  };
12
- type jzodElementSchema = jzodLiteralSchema;
12
+ type jzodElement = jzodLiteral;
13
13
  type testJzodSchema3 = {
14
- b: jzodElementSchema[];
14
+ b: jzodElement[];
15
15
  };
16
16
 
17
- export const jzodLiteralSchema=z.object({optional:z.boolean().optional(),extra:z.record(z.string(),z.any()).optional(),type:z.literal("literal"),definition:z.string(),}).strict();
18
- export const jzodElementSchema=z.union([z.lazy(() =>jzodLiteralSchema),]);
19
- export const testJzodSchema3 = z.object({b:z.array(z.lazy(() =>jzodElementSchema)),}).strict();
17
+ export const jzodLiteral=z.object({optional:z.boolean().optional(),extra:z.record(z.string(),z.any()).optional(),type:z.literal("literal"),definition:z.string(),}).strict();
18
+ export const jzodElement=z.union([z.lazy(() =>jzodLiteral),]);
19
+ export const testJzodSchema3 = z.object({b:z.array(z.lazy(() =>jzodElement)),}).strict();