Skip to content

Unable to define enum default value on an input type #1862

Closed

Description

Describe the bug
Defining a default value for an enum property on an input type throws the following exception:

SchemaException: Could not parse the native value of input field `{0}.{1}`. - Type: FilterInput

Where FilterInput is:

    public sealed class Filter
    {
        [DefaultValue(OrderByEnum.POPULARITY)]
        public OrderByEnum OrderBy { get; set; }
    }

And OrderByEnum is:

    public enum OrderByEnum
    {
        SORT_INDEX_ASC,
        SORT_INDEX_DESC,
        ALPHABETICAL_ASC,
        ALPHABETICAL_DESC,
        POPULARITY
    }

Expected behavior
That the following schema gets created:

input FilterInput {
  orderBy: OrderByEnum = POPULARITY
}

HC version: 10.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions