Skip to content

C# Plugin: GraphQL namespace in generated code not used at all #6340

@seclerp

Description

@seclerp

Describe the bug
using GraphQL; declaration is included in generated code, but not used at all. Such behavior creates some problems when using this plugin for projects that have no GraphQL dependency installed at all or when it uses another .NET GraphQL framework (HotChocolate in my case).

To Reproduce
Just generate C# code using the data provided below.

  1. My GraphQL schema:
enum ns {
  dummy
}
  1. My codegen.yml config file:
schema: schema.gql
generates:
  MyTypes.cs:
    plugins:
      - c-sharp
    config:
      namespaceName: MyCompany.MyNamespace

Expected behavior
Generated C# code will not have unused GraphQL dependency

Environment:

  • OS: Windows
  • @graphql-codegen/cli: 1.21.7
  • @graphql-codegen/c-sharp: 3.0.2
  • NodeJS: 14.16.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementNew feature or requeststage/5-alpha-release-testingThe pull request is merged, an alpha release is available, to be tested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions