File tree Expand file tree Collapse file tree 8 files changed +503
-525
lines changed Expand file tree Collapse file tree 8 files changed +503
-525
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ generates:
1313 schema : yup
1414 importFrom : ../types
1515 withObjectType : true
16- withInterfaceType : true
1716 directives :
1817 required :
1918 msg : required
@@ -50,7 +49,6 @@ generates:
5049 schema : zod
5150 importFrom : ../types
5251 withObjectType : true
53- withInterfaceType : true
5452 directives :
5553 # Write directives like
5654 #
@@ -74,7 +72,6 @@ generates:
7472 schema : myzod
7573 importFrom : ../types
7674 withObjectType : true
77- withInterfaceType : true
7875 directives :
7976 constraint :
8077 minLength : min
Original file line number Diff line number Diff line change @@ -194,24 +194,6 @@ export interface ValidationSchemaPluginConfig extends TypeScriptPluginConfig {
194194 * ```
195195 */
196196 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
215197 /**
216198 * @description Specify validation schema export type.
217199 * @default function
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ export class MyZodSchemaVisitor extends BaseSchemaVisitor {
6363
6464 get InterfaceTypeDefinition ( ) {
6565 return {
66- leave : InterfaceTypeDefinitionBuilder ( this . config . withInterfaceType , ( node : InterfaceTypeDefinitionNode ) => {
66+ leave : InterfaceTypeDefinitionBuilder ( this . config . withObjectType , ( node : InterfaceTypeDefinitionNode ) => {
6767 const visitor = this . createVisitor ( 'output' ) ;
6868 const name = visitor . convertName ( node . name . value ) ;
6969 this . importTypes . push ( name ) ;
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ export class YupSchemaVisitor extends BaseSchemaVisitor {
7070
7171 get InterfaceTypeDefinition ( ) {
7272 return {
73- leave : InterfaceTypeDefinitionBuilder ( this . config . withInterfaceType , ( node : InterfaceTypeDefinitionNode ) => {
73+ leave : InterfaceTypeDefinitionBuilder ( this . config . withObjectType , ( node : InterfaceTypeDefinitionNode ) => {
7474 const visitor = this . createVisitor ( 'output' ) ;
7575 const name = visitor . convertName ( node . name . value ) ;
7676 this . importTypes . push ( name ) ;
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ export class ZodSchemaVisitor extends BaseSchemaVisitor {
7979
8080 get InterfaceTypeDefinition ( ) {
8181 return {
82- leave : InterfaceTypeDefinitionBuilder ( this . config . withInterfaceType , ( node : InterfaceTypeDefinitionNode ) => {
82+ leave : InterfaceTypeDefinitionBuilder ( this . config . withObjectType , ( node : InterfaceTypeDefinitionNode ) => {
8383 const visitor = this . createVisitor ( 'output' ) ;
8484 const name = visitor . convertName ( node . name . value ) ;
8585 this . importTypes . push ( name ) ;
You can’t perform that action at this time.
0 commit comments