Search code examples
graphqlhotchocolate

Hot Chocolate can't set default value for field of input type


I have a class with an enum field declared like this:

public class PostPhotoInput
{

    [DefaultValue(PhotoCategory.Portrait)]
    public PhotoCategory Category { get; set; }
}

I expect it to produce SDL that looks like this:

input PostPhotoInput {
    category: PhotoCategory = PORTRAIT
}

Instead, when I reload the docs in Altair, I get the error: Could not parse the native value of input field 'PostPhotoInput.category'.

How do I get the desired SDL?


Solution

  • This is a bug that will be fixed with this PR: https://github.com/ChilliCream/hotchocolate/pull/4129