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

Enum return value not included in definitions #210

Open
andyrooger opened this issue Jan 28, 2021 · 0 comments
Open

Enum return value not included in definitions #210

andyrooger opened this issue Jan 28, 2021 · 0 comments

Comments

@andyrooger
Copy link

I have code similar to the following

[ServiceContract(Namespace="blah")]
[SwaggerWcf("/v1/rest")]
[SwaggerWcfServiceInfo("x", "y")]
public interface IService
{
    [OperationContract, WebGet()]
    MyEnum GetEnum();
}

[DataContract(Namespace = "blah")]
[Flags]
public enum MyEnum
{
    [EnumMember]
    One = 1,
    [EnumMember]
    Two = 2
}

The resulting swagger JSON refers to #definitions/MyEnum as the ref for the method response type, but that definition does not exist in the definition. Thus I have an invalid swagger JSON.

Debugging this, it looks like it makes it into the list of types to include but then is ignored when including in the schema since it's treated as primitive. This is because all enums seem to be treated as type=integer + format=enum and all integers, whether or not they're enums are treated as primitive.

So can we exclude enums from the primitives check in TypeFormat?

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

1 participant