Skip to content

Support Query/Mutation filtering #13

@nabeix

Description

@nabeix

Problem

We need generate documents for multiple client from one schema.
GraphQL documents generates documents of all Query/Mutation.
So, the generated documents includes unnecessary document for a client.
It makes overhead of module size.

Suggestion

codegen.yml

overwrite: true
schema:
  - ./schemas/**/*.graphql

generates:
  ./documents/index.graphql:
    plugins:
      - graphql-codegen-documents
    config:
      - tags:
          - client

index.graphql

type Query {
  books(first: Int!, offset: Int!): BooksConnection!  # graphql-codegen-documents: tag=client

  user(first: Int!, offset: Int!): UserConnection! # this is always target
}

I don't know graphql codegen plugin can read # comment line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions