Skip to content

Generate enums as graphqlenumtype in the schema with descriptions #1597

@togakangaroo

Description

@togakangaroo

We have enums with attached descriptions:

    public enum DiseaseType
    {
        [Description("Brucellosis")]
        BR,
        [Description("Chronic Wasting Disease")] 
        CWD,
        [Description("Scrapie")]
        SCR,
        [Description("Tuberculosis")]
        TB,
        [Description("Avian Influenza")]
        AI,
        ...

I assumed that when I looked in my schema I'd see all that in a GraphqlEnumType but instead see the following in the schema in my graphql playground

enum DiseaseType {
  BR
  CWD
  SCR
  TB
  AI

we do have this registered via IoC

graphQLBuilder.Services.AddSingleton(typeof(DiseaseType), _ => new EnumerationGraphType<DiseaseType>());

So is it possible to include descriptions along with the values?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionDeveloper asks to help him deal with some problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions