@vladimirdev635/gql-codegen 0.0.80 → 0.0.83
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/actors/ts/graphql/generators/server/scalars/additional.js +1 -1
- package/package.json +1 -1
- package/schema/client/directive.d.ts +2 -0
- package/schema/client/operation.d.ts +2 -0
- package/schema/client/root.d.ts +4 -0
- package/schema/schema.spec.js +2 -2
- package/schema/server.d.ts +14 -0
- package/schema/shared.d.ts +8 -0
- package/schema/shared.js +16 -2
|
@@ -13,7 +13,7 @@ export const additionalScalarsMapping = {
|
|
|
13
13
|
Upload: buildSymmetricScalarSpec(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'file'), undefined, [])),
|
|
14
14
|
Url: {
|
|
15
15
|
inputSchema: invokeMethod(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'custom'), [ts.factory.createTypeReferenceNode('URL')], []), 'transform', [ts.factory.createArrowFunction(undefined, undefined, [ts.factory.createParameterDeclaration(undefined, undefined, 'url')], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), invokeMethod(ts.factory.createIdentifier('url'), 'toString', []))]),
|
|
16
|
-
outputSchema: ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), '
|
|
16
|
+
outputSchema: invokeMethod(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'string'), [], []), 'transform', [ts.factory.createArrowFunction(undefined, undefined, [ts.factory.createParameterDeclaration(undefined, undefined, 'v')], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createNewExpression(ts.factory.createIdentifier('Url'), undefined, [ts.factory.createIdentifier('v')]))]),
|
|
17
17
|
},
|
|
18
18
|
Void: buildSymmetricScalarSpec(ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'any'), undefined, [])),
|
|
19
19
|
Date: {
|
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ export declare const directiveSchema: z.ZodObject<{
|
|
|
17
17
|
name: z.ZodString;
|
|
18
18
|
$ref: z.ZodString;
|
|
19
19
|
}, z.core.$strip>]>;
|
|
20
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
20
21
|
}, z.core.$strip>, z.ZodObject<{
|
|
21
22
|
_type: z.ZodLiteral<"array">;
|
|
22
23
|
nullable: z.ZodBoolean;
|
|
@@ -32,6 +33,7 @@ export declare const directiveSchema: z.ZodObject<{
|
|
|
32
33
|
name: z.ZodString;
|
|
33
34
|
$ref: z.ZodString;
|
|
34
35
|
}, z.core.$strip>]>;
|
|
36
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
35
37
|
}, z.core.$strip>]>;
|
|
36
38
|
}, z.core.$strip>>;
|
|
37
39
|
locations: z.ZodArray<z.ZodEnum<{
|
|
@@ -22,6 +22,7 @@ export declare const operationSchema: z.ZodObject<{
|
|
|
22
22
|
name: z.ZodString;
|
|
23
23
|
$ref: z.ZodString;
|
|
24
24
|
}, z.core.$strip>]>;
|
|
25
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
25
26
|
}, z.core.$strip>, z.ZodObject<{
|
|
26
27
|
_type: z.ZodLiteral<"array">;
|
|
27
28
|
nullable: z.ZodBoolean;
|
|
@@ -37,6 +38,7 @@ export declare const operationSchema: z.ZodObject<{
|
|
|
37
38
|
name: z.ZodString;
|
|
38
39
|
$ref: z.ZodString;
|
|
39
40
|
}, z.core.$strip>]>;
|
|
41
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
40
42
|
}, z.core.$strip>]>;
|
|
41
43
|
}, z.core.$strip>>;
|
|
42
44
|
fragmentSpec: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
package/schema/client/root.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export declare const clientSchema: z.ZodObject<{
|
|
|
35
35
|
name: z.ZodString;
|
|
36
36
|
$ref: z.ZodString;
|
|
37
37
|
}, z.core.$strip>]>;
|
|
38
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
38
39
|
}, z.core.$strip>, z.ZodObject<{
|
|
39
40
|
_type: z.ZodLiteral<"array">;
|
|
40
41
|
nullable: z.ZodBoolean;
|
|
@@ -50,6 +51,7 @@ export declare const clientSchema: z.ZodObject<{
|
|
|
50
51
|
name: z.ZodString;
|
|
51
52
|
$ref: z.ZodString;
|
|
52
53
|
}, z.core.$strip>]>;
|
|
54
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
53
55
|
}, z.core.$strip>]>;
|
|
54
56
|
}, z.core.$strip>>;
|
|
55
57
|
fragmentSpec: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -81,6 +83,7 @@ export declare const clientSchema: z.ZodObject<{
|
|
|
81
83
|
name: z.ZodString;
|
|
82
84
|
$ref: z.ZodString;
|
|
83
85
|
}, z.core.$strip>]>;
|
|
86
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
84
87
|
}, z.core.$strip>, z.ZodObject<{
|
|
85
88
|
_type: z.ZodLiteral<"array">;
|
|
86
89
|
nullable: z.ZodBoolean;
|
|
@@ -96,6 +99,7 @@ export declare const clientSchema: z.ZodObject<{
|
|
|
96
99
|
name: z.ZodString;
|
|
97
100
|
$ref: z.ZodString;
|
|
98
101
|
}, z.core.$strip>]>;
|
|
102
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
99
103
|
}, z.core.$strip>]>;
|
|
100
104
|
}, z.core.$strip>>;
|
|
101
105
|
locations: z.ZodArray<z.ZodEnum<{
|
package/schema/schema.spec.js
CHANGED
|
@@ -6,12 +6,12 @@ import { clientSchema } from './client/root.js';
|
|
|
6
6
|
describe('Server schema', () => {
|
|
7
7
|
it('Should parse ok', () => {
|
|
8
8
|
const result = serverSchema.safeParse(testServerJSON);
|
|
9
|
-
expect(result.success, result.error?.message
|
|
9
|
+
expect(result.success, result.error?.message || '').toBe(true);
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
12
|
describe('Client schema', () => {
|
|
13
13
|
it('Should parse ok', () => {
|
|
14
14
|
const result = clientSchema.safeParse(testClientJSON);
|
|
15
|
-
expect(result.success, result.error?.message
|
|
15
|
+
expect(result.success, result.error?.message || '').toBe(true);
|
|
16
16
|
});
|
|
17
17
|
});
|
package/schema/server.d.ts
CHANGED
|
@@ -176,6 +176,7 @@ export declare const callableSpecSchema: z.ZodObject<{
|
|
|
176
176
|
name: z.ZodString;
|
|
177
177
|
$ref: z.ZodString;
|
|
178
178
|
}, z.core.$strip>]>;
|
|
179
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
179
180
|
}, z.core.$strip>, z.ZodObject<{
|
|
180
181
|
_type: z.ZodLiteral<"array">;
|
|
181
182
|
nullable: z.ZodBoolean;
|
|
@@ -191,6 +192,7 @@ export declare const callableSpecSchema: z.ZodObject<{
|
|
|
191
192
|
name: z.ZodString;
|
|
192
193
|
$ref: z.ZodString;
|
|
193
194
|
}, z.core.$strip>]>;
|
|
195
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
194
196
|
}, z.core.$strip>]>;
|
|
195
197
|
}, z.core.$strip>>;
|
|
196
198
|
}, z.core.$strip>;
|
|
@@ -303,6 +305,7 @@ export declare const objectFieldSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
303
305
|
name: z.ZodString;
|
|
304
306
|
$ref: z.ZodString;
|
|
305
307
|
}, z.core.$strip>]>;
|
|
308
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
306
309
|
}, z.core.$strip>, z.ZodObject<{
|
|
307
310
|
_type: z.ZodLiteral<"array">;
|
|
308
311
|
nullable: z.ZodBoolean;
|
|
@@ -318,6 +321,7 @@ export declare const objectFieldSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
318
321
|
name: z.ZodString;
|
|
319
322
|
$ref: z.ZodString;
|
|
320
323
|
}, z.core.$strip>]>;
|
|
324
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
321
325
|
}, z.core.$strip>]>;
|
|
322
326
|
}, z.core.$strip>>;
|
|
323
327
|
}, z.core.$strip>]>;
|
|
@@ -432,6 +436,7 @@ export declare const objectFieldSchema: z.ZodObject<{
|
|
|
432
436
|
name: z.ZodString;
|
|
433
437
|
$ref: z.ZodString;
|
|
434
438
|
}, z.core.$strip>]>;
|
|
439
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
435
440
|
}, z.core.$strip>, z.ZodObject<{
|
|
436
441
|
_type: z.ZodLiteral<"array">;
|
|
437
442
|
nullable: z.ZodBoolean;
|
|
@@ -447,6 +452,7 @@ export declare const objectFieldSchema: z.ZodObject<{
|
|
|
447
452
|
name: z.ZodString;
|
|
448
453
|
$ref: z.ZodString;
|
|
449
454
|
}, z.core.$strip>]>;
|
|
455
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
450
456
|
}, z.core.$strip>]>;
|
|
451
457
|
}, z.core.$strip>>;
|
|
452
458
|
}, z.core.$strip>]>;
|
|
@@ -565,6 +571,7 @@ export declare const objectSchema: z.ZodObject<{
|
|
|
565
571
|
name: z.ZodString;
|
|
566
572
|
$ref: z.ZodString;
|
|
567
573
|
}, z.core.$strip>]>;
|
|
574
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
568
575
|
}, z.core.$strip>, z.ZodObject<{
|
|
569
576
|
_type: z.ZodLiteral<"array">;
|
|
570
577
|
nullable: z.ZodBoolean;
|
|
@@ -580,6 +587,7 @@ export declare const objectSchema: z.ZodObject<{
|
|
|
580
587
|
name: z.ZodString;
|
|
581
588
|
$ref: z.ZodString;
|
|
582
589
|
}, z.core.$strip>]>;
|
|
590
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
583
591
|
}, z.core.$strip>]>;
|
|
584
592
|
}, z.core.$strip>>;
|
|
585
593
|
}, z.core.$strip>]>;
|
|
@@ -603,6 +611,7 @@ export declare const inputSchema: z.ZodObject<{
|
|
|
603
611
|
name: z.ZodString;
|
|
604
612
|
$ref: z.ZodString;
|
|
605
613
|
}, z.core.$strip>]>;
|
|
614
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
606
615
|
}, z.core.$strip>, z.ZodObject<{
|
|
607
616
|
_type: z.ZodLiteral<"array">;
|
|
608
617
|
nullable: z.ZodBoolean;
|
|
@@ -618,6 +627,7 @@ export declare const inputSchema: z.ZodObject<{
|
|
|
618
627
|
name: z.ZodString;
|
|
619
628
|
$ref: z.ZodString;
|
|
620
629
|
}, z.core.$strip>]>;
|
|
630
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
621
631
|
}, z.core.$strip>]>;
|
|
622
632
|
}, z.core.$strip>>;
|
|
623
633
|
}, z.core.$strip>;
|
|
@@ -773,6 +783,7 @@ export declare const serverSchema: z.ZodObject<{
|
|
|
773
783
|
name: z.ZodString;
|
|
774
784
|
$ref: z.ZodString;
|
|
775
785
|
}, z.core.$strip>]>;
|
|
786
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
776
787
|
}, z.core.$strip>, z.ZodObject<{
|
|
777
788
|
_type: z.ZodLiteral<"array">;
|
|
778
789
|
nullable: z.ZodBoolean;
|
|
@@ -788,6 +799,7 @@ export declare const serverSchema: z.ZodObject<{
|
|
|
788
799
|
name: z.ZodString;
|
|
789
800
|
$ref: z.ZodString;
|
|
790
801
|
}, z.core.$strip>]>;
|
|
802
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
791
803
|
}, z.core.$strip>]>;
|
|
792
804
|
}, z.core.$strip>>;
|
|
793
805
|
}, z.core.$strip>]>;
|
|
@@ -836,6 +848,7 @@ export declare const serverSchema: z.ZodObject<{
|
|
|
836
848
|
name: z.ZodString;
|
|
837
849
|
$ref: z.ZodString;
|
|
838
850
|
}, z.core.$strip>]>;
|
|
851
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
839
852
|
}, z.core.$strip>, z.ZodObject<{
|
|
840
853
|
_type: z.ZodLiteral<"array">;
|
|
841
854
|
nullable: z.ZodBoolean;
|
|
@@ -851,6 +864,7 @@ export declare const serverSchema: z.ZodObject<{
|
|
|
851
864
|
name: z.ZodString;
|
|
852
865
|
$ref: z.ZodString;
|
|
853
866
|
}, z.core.$strip>]>;
|
|
867
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
854
868
|
}, z.core.$strip>]>;
|
|
855
869
|
}, z.core.$strip>>;
|
|
856
870
|
}, z.core.$strip>>;
|
package/schema/shared.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export declare const inputTypeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
11
11
|
name: z.ZodString;
|
|
12
12
|
$ref: z.ZodString;
|
|
13
13
|
}, z.core.$strip>]>;
|
|
14
|
+
export declare const literalSchema: z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>;
|
|
15
|
+
export declare const arrayLiteralSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>;
|
|
14
16
|
export declare const inputLiteralSpecSchema: z.ZodObject<{
|
|
15
17
|
_type: z.ZodLiteral<"literal">;
|
|
16
18
|
type: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -25,6 +27,7 @@ export declare const inputLiteralSpecSchema: z.ZodObject<{
|
|
|
25
27
|
name: z.ZodString;
|
|
26
28
|
$ref: z.ZodString;
|
|
27
29
|
}, z.core.$strip>]>;
|
|
30
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
28
31
|
}, z.core.$strip>;
|
|
29
32
|
export declare const inputArraySpecSchema: z.ZodObject<{
|
|
30
33
|
_type: z.ZodLiteral<"array">;
|
|
@@ -41,6 +44,7 @@ export declare const inputArraySpecSchema: z.ZodObject<{
|
|
|
41
44
|
name: z.ZodString;
|
|
42
45
|
$ref: z.ZodString;
|
|
43
46
|
}, z.core.$strip>]>;
|
|
47
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
44
48
|
}, z.core.$strip>;
|
|
45
49
|
export declare const inputFieldSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
46
50
|
_type: z.ZodLiteral<"literal">;
|
|
@@ -56,6 +60,7 @@ export declare const inputFieldSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
56
60
|
name: z.ZodString;
|
|
57
61
|
$ref: z.ZodString;
|
|
58
62
|
}, z.core.$strip>]>;
|
|
63
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
59
64
|
}, z.core.$strip>, z.ZodObject<{
|
|
60
65
|
_type: z.ZodLiteral<"array">;
|
|
61
66
|
nullable: z.ZodBoolean;
|
|
@@ -71,6 +76,7 @@ export declare const inputFieldSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
71
76
|
name: z.ZodString;
|
|
72
77
|
$ref: z.ZodString;
|
|
73
78
|
}, z.core.$strip>]>;
|
|
79
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
74
80
|
}, z.core.$strip>]>;
|
|
75
81
|
export declare const inputFieldSchema: z.ZodObject<{
|
|
76
82
|
nullable: z.ZodBoolean;
|
|
@@ -88,6 +94,7 @@ export declare const inputFieldSchema: z.ZodObject<{
|
|
|
88
94
|
name: z.ZodString;
|
|
89
95
|
$ref: z.ZodString;
|
|
90
96
|
}, z.core.$strip>]>;
|
|
97
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt, z.ZodFloat32, z.ZodBoolean]>>>;
|
|
91
98
|
}, z.core.$strip>, z.ZodObject<{
|
|
92
99
|
_type: z.ZodLiteral<"array">;
|
|
93
100
|
nullable: z.ZodBoolean;
|
|
@@ -103,5 +110,6 @@ export declare const inputFieldSchema: z.ZodObject<{
|
|
|
103
110
|
name: z.ZodString;
|
|
104
111
|
$ref: z.ZodString;
|
|
105
112
|
}, z.core.$strip>]>;
|
|
113
|
+
defaultValue: z.ZodNullable<z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodString>, z.ZodArray<z.ZodInt>, z.ZodArray<z.ZodFloat32>, z.ZodArray<z.ZodBoolean>]>>>;
|
|
106
114
|
}, z.core.$strip>]>;
|
|
107
115
|
}, z.core.$strip>;
|
package/schema/shared.js
CHANGED
|
@@ -15,14 +15,28 @@ export const inputTypeSchema = z.discriminatedUnion('_type', [
|
|
|
15
15
|
$ref: z.string()
|
|
16
16
|
}),
|
|
17
17
|
]);
|
|
18
|
+
export const literalSchema = z.union([
|
|
19
|
+
z.string(),
|
|
20
|
+
z.int(),
|
|
21
|
+
z.float32(),
|
|
22
|
+
z.boolean()
|
|
23
|
+
]);
|
|
24
|
+
export const arrayLiteralSchema = z.union([
|
|
25
|
+
z.array(z.string()),
|
|
26
|
+
z.array(z.int()),
|
|
27
|
+
z.array(z.float32()),
|
|
28
|
+
z.array(z.boolean())
|
|
29
|
+
]);
|
|
18
30
|
export const inputLiteralSpecSchema = z.object({
|
|
19
31
|
_type: z.literal('literal'),
|
|
20
|
-
type: inputTypeSchema
|
|
32
|
+
type: inputTypeSchema,
|
|
33
|
+
defaultValue: literalSchema.optional().nullable()
|
|
21
34
|
});
|
|
22
35
|
export const inputArraySpecSchema = z.object({
|
|
23
36
|
_type: z.literal('array'),
|
|
24
37
|
nullable: z.boolean(),
|
|
25
|
-
type: inputTypeSchema
|
|
38
|
+
type: inputTypeSchema,
|
|
39
|
+
defaultValue: arrayLiteralSchema.optional().nullable()
|
|
26
40
|
});
|
|
27
41
|
export const inputFieldSpecSchema = z.discriminatedUnion('_type', [
|
|
28
42
|
inputLiteralSpecSchema,
|