File tree 8 files changed +503
-525
lines changed
8 files changed +503
-525
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ generates:
13
13
schema : yup
14
14
importFrom : ../types
15
15
withObjectType : true
16
- withInterfaceType : true
17
16
directives :
18
17
required :
19
18
msg : required
@@ -50,7 +49,6 @@ generates:
50
49
schema : zod
51
50
importFrom : ../types
52
51
withObjectType : true
53
- withInterfaceType : true
54
52
directives :
55
53
# Write directives like
56
54
#
@@ -74,7 +72,6 @@ generates:
74
72
schema : myzod
75
73
importFrom : ../types
76
74
withObjectType : true
77
- withInterfaceType : true
78
75
directives :
79
76
constraint :
80
77
minLength : min
Original file line number Diff line number Diff line change @@ -194,24 +194,6 @@ export interface ValidationSchemaPluginConfig extends TypeScriptPluginConfig {
194
194
* ```
195
195
*/
196
196
withObjectType ?: boolean
197
- /**
198
- * @description Generates validation schema with GraphQL type interfaces.
199
- *
200
- * @exampleMarkdown
201
- * ```yml
202
- * generates:
203
- * path/to/types.ts:
204
- * plugins:
205
- * - typescript
206
- * path/to/schemas.ts:
207
- * plugins:
208
- * - graphql-codegen-validation-schema
209
- * config:
210
- * schema: yup
211
- * withInterfaceType: true
212
- * ```
213
- */
214
- withInterfaceType ?: boolean
215
197
/**
216
198
* @description Specify validation schema export type.
217
199
* @default function
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export class MyZodSchemaVisitor extends BaseSchemaVisitor {
63
63
64
64
get InterfaceTypeDefinition ( ) {
65
65
return {
66
- leave : InterfaceTypeDefinitionBuilder ( this . config . withInterfaceType , ( node : InterfaceTypeDefinitionNode ) => {
66
+ leave : InterfaceTypeDefinitionBuilder ( this . config . withObjectType , ( node : InterfaceTypeDefinitionNode ) => {
67
67
const visitor = this . createVisitor ( 'output' ) ;
68
68
const name = visitor . convertName ( node . name . value ) ;
69
69
this . importTypes . push ( name ) ;
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ export class YupSchemaVisitor extends BaseSchemaVisitor {
70
70
71
71
get InterfaceTypeDefinition ( ) {
72
72
return {
73
- leave : InterfaceTypeDefinitionBuilder ( this . config . withInterfaceType , ( node : InterfaceTypeDefinitionNode ) => {
73
+ leave : InterfaceTypeDefinitionBuilder ( this . config . withObjectType , ( node : InterfaceTypeDefinitionNode ) => {
74
74
const visitor = this . createVisitor ( 'output' ) ;
75
75
const name = visitor . convertName ( node . name . value ) ;
76
76
this . importTypes . push ( name ) ;
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ export class ZodSchemaVisitor extends BaseSchemaVisitor {
79
79
80
80
get InterfaceTypeDefinition ( ) {
81
81
return {
82
- leave : InterfaceTypeDefinitionBuilder ( this . config . withInterfaceType , ( node : InterfaceTypeDefinitionNode ) => {
82
+ leave : InterfaceTypeDefinitionBuilder ( this . config . withObjectType , ( node : InterfaceTypeDefinitionNode ) => {
83
83
const visitor = this . createVisitor ( 'output' ) ;
84
84
const name = visitor . convertName ( node . name . value ) ;
85
85
this . importTypes . push ( name ) ;
You can’t perform that action at this time.
0 commit comments