Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed withInterfaceType option #610

Merged
merged 1 commit into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ generates:
schema: yup
importFrom: ../types
withObjectType: true
withInterfaceType: true
directives:
required:
msg: required
Expand Down Expand Up @@ -50,7 +49,6 @@ generates:
schema: zod
importFrom: ../types
withObjectType: true
withInterfaceType: true
directives:
# Write directives like
#
Expand All @@ -74,7 +72,6 @@ generates:
schema: myzod
importFrom: ../types
withObjectType: true
withInterfaceType: true
directives:
constraint:
minLength: min
Expand Down
18 changes: 0 additions & 18 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,6 @@ export interface ValidationSchemaPluginConfig extends TypeScriptPluginConfig {
* ```
*/
withObjectType?: boolean
/**
* @description Generates validation schema with GraphQL type interfaces.
*
* @exampleMarkdown
* ```yml
* generates:
* path/to/types.ts:
* plugins:
* - typescript
* path/to/schemas.ts:
* plugins:
* - graphql-codegen-validation-schema
* config:
* schema: yup
* withInterfaceType: true
* ```
*/
withInterfaceType?: boolean
/**
* @description Specify validation schema export type.
* @default function
Expand Down
2 changes: 1 addition & 1 deletion src/myzod/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class MyZodSchemaVisitor extends BaseSchemaVisitor {

get InterfaceTypeDefinition() {
return {
leave: InterfaceTypeDefinitionBuilder(this.config.withInterfaceType, (node: InterfaceTypeDefinitionNode) => {
leave: InterfaceTypeDefinitionBuilder(this.config.withObjectType, (node: InterfaceTypeDefinitionNode) => {
const visitor = this.createVisitor('output');
const name = visitor.convertName(node.name.value);
this.importTypes.push(name);
Expand Down
2 changes: 1 addition & 1 deletion src/yup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class YupSchemaVisitor extends BaseSchemaVisitor {

get InterfaceTypeDefinition() {
return {
leave: InterfaceTypeDefinitionBuilder(this.config.withInterfaceType, (node: InterfaceTypeDefinitionNode) => {
leave: InterfaceTypeDefinitionBuilder(this.config.withObjectType, (node: InterfaceTypeDefinitionNode) => {
const visitor = this.createVisitor('output');
const name = visitor.convertName(node.name.value);
this.importTypes.push(name);
Expand Down
2 changes: 1 addition & 1 deletion src/zod/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class ZodSchemaVisitor extends BaseSchemaVisitor {

get InterfaceTypeDefinition() {
return {
leave: InterfaceTypeDefinitionBuilder(this.config.withInterfaceType, (node: InterfaceTypeDefinitionNode) => {
leave: InterfaceTypeDefinitionBuilder(this.config.withObjectType, (node: InterfaceTypeDefinitionNode) => {
const visitor = this.createVisitor('output');
const name = visitor.convertName(node.name.value);
this.importTypes.push(name);
Expand Down
Loading
Loading