fix 373 by Code-Hex · Pull Request #375 · Code-Hex/graphql-codegen-typescript-validation-schema
fixed #373
For those who have been using this plugin, the following adjustments will be required with this PR.
Before
config: # You can put the config for typescript plugin here # see: https://www.graphql-code-generator.com/plugins/typescript strictScalars: true # You can also write the config for this plugin together schema: yup # or zod
After
config: # You can put the config for typescript plugin here # see: https://www.graphql-code-generator.com/plugins/typescript strictScalars: true # Overrides built-in ID scalar to both input and output types as string. # see: https://the-guild.dev/graphql/codegen/plugins/typescript/typescript#scalars scalars: ID: string # You can also write the config for this plugin together schema: yup # or zod
By doing this, the built-in type ID will use the string type for both input and output, just as it did before.
In this plugin, if a union such as string | number is specified in the scalar, it will generate a validation schema equivalent to validating any type.