Skip to content

Commit e17fdfd

Browse files
authored
Merge pull request #610 from Code-Hex/remove/with-interface-type
removed withInterfaceType option
2 parents 24518ad + 7d82b8d commit e17fdfd

File tree

8 files changed

+503
-525
lines changed

8 files changed

+503
-525
lines changed

codegen.yml

-3
Original file line numberDiff line numberDiff 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

src/config.ts

-18
Original file line numberDiff line numberDiff 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

src/myzod/index.ts

+1-1
Original file line numberDiff line numberDiff 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);

src/yup/index.ts

+1-1
Original file line numberDiff line numberDiff 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);

src/zod/index.ts

+1-1
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)