Skip to content

EnumTypeExtension doesn't change name of enum value #4108

@tobias-tengler

Description

@tobias-tengler

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I'm trying to change the schema name of an enum value using EnumTypeExtension. The API is present, but the name of the enum value is not changed.

Steps to reproduce

public enum ExampleEnum
{
    Value1
}

public class ExampleEnumExtensions : EnumTypeExtension
{
    protected override void Configure(IEnumTypeDescriptor descriptor)
    {
        descriptor.Name(nameof(ExampleEnum));

        descriptor.Value(ExampleEnum.Value1).Name("Test");
    }
}

public class Query
{
    public ExampleEnum GetEnumValue() => ExampleEnum.Value1;
}

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services
            .AddGraphQLServer()
            .AddTypeExtension<ExampleEnumExtensions>()
            .AddQueryType<Query>();
    }
}

Relevant log output

No response

Additional Context?

No response

Product

Hot Chocolate

Version

12.0.0-preview.30

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions