Skip to content

doesn't work with client-preset #303

Closed
@erwan-joly

Description

@erwan-joly

Hi, it seems like when using the client-preset the configuration is totally ignored.

import { CodegenConfig } from '@graphql-codegen/cli'

const config: CodegenConfig = {
    sort: false,
    schema: "file.graphql",
    documents: [
        "src/**/*.gql"
    ],
    ignoreNoDocuments: true,
    generates: {
        './src/graphql/': {
            preset: 'client',
            plugins: [
                "typescript-validation-schema",
            ],
            config: {
                 importFrom: './graphql',
                strictScalars: true,
                schema: 'zod',
            }
        }
    }
}

export default config

this code would result in the validation schema using yup (default configuration) instead of zod

I need an extra generation to get it to use the right configuration

import { CodegenConfig } from '@graphql-codegen/cli'

const config: CodegenConfig = {
    sort: false,
    schema: "file.graphql",
    documents: [
        "src/**/*.gql"
    ],
    ignoreNoDocuments: true,
    generates: {
        './src/graphql/validation.ts': {
            plugins: [
                "typescript-validation-schema",
            ],
            config: {
                importFrom: './graphql',
                strictScalars: true,
                schema: 'zod',
            }
        },
        './src/graphql/': {
            preset: 'client',
            plugins: [],
            config: {
            
            }
        }
    }
}

export default config

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions