Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enums marked with alternate values using [EnumMember(Value="...")] are not supported #562

Closed
mikegoatly opened this issue Nov 9, 2015 · 1 comment

Comments

@mikegoatly
Copy link

Forgive the contrived example, but given the following code:

public class DefaultController : ApiController
{
    [ResponseType(typeof(TestResult))]
    public IHttpActionResult Get(string id)
    {
        return this.Ok(new TestResult());
    }
}

[DataContract]
public class TestResult
{
    [DataMember]
    public TestEnum Type { get; set; }
}

[DataContract]
public enum TestEnum
{
    [EnumMember(Value = "roger")]
    None = 0,
    [EnumMember(Value = "blake")]
    Something = 1,
    [EnumMember(Value = "sarah")]
    SomethingElse = 2
}

The API will return "roger", "blake" or "sarah" depending on the enum value. Swashbuckle does not pick up on the alternative names and reports that the potential options are "None", "Something" or "SomethingElse".

@domaindrivendev
Copy link
Owner

See 5.3.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants