diff --git a/src/HotChocolate/Core/src/Abstractions/GraphQLDescriptionAttribute.cs b/src/HotChocolate/Core/src/Abstractions/GraphQLDescriptionAttribute.cs index cf2e9b91f95..6404050c6aa 100644 --- a/src/HotChocolate/Core/src/Abstractions/GraphQLDescriptionAttribute.cs +++ b/src/HotChocolate/Core/src/Abstractions/GraphQLDescriptionAttribute.cs @@ -7,6 +7,7 @@ namespace HotChocolate | AttributeTargets.Interface | AttributeTargets.Property | AttributeTargets.Method + | AttributeTargets.Enum | AttributeTargets.Parameter | AttributeTargets.Field)] public sealed class GraphQLDescriptionAttribute diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs b/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs index 077f67d4c1f..29c59858ace 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs +++ b/src/HotChocolate/Core/test/Types.Tests/Types/EnumTypeTests.cs @@ -32,6 +32,22 @@ public void EnumType_DynamicName() Assert.NotNull(type); } + [Fact] + public void EnumType_GraphQLDescriptionAttribute() + { + // act + var schema = Schema.Create(c => + { + c.RegisterType(new EnumType()); + + c.Options.StrictValidation = false; + }); + + // assert + EnumType type = schema.GetType("DescriptionTestEnum"); + Assert.Equal("TestDescription", type.Description); + } + [Fact] public void EnumType_DynamicName_NonGeneric() { @@ -590,5 +606,11 @@ protected override void Configure(IEnumTypeDescriptor descriptor) descriptor.Value("ABC").Name("DEF"); } } + + [GraphQLDescription("TestDescription")] + public enum DescriptionTestEnum + { + Foo, Bar + } } }