aliencube / AzureFunctions.Extensions

This provides some useful extensions for Azure Functions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enum values not showing in rendered document

michaelstaszewski opened this issue · comments

This is related to #26 and #33.

I have an enum defined as follows...

[JsonConverter(typeof(StringEnumConverter))]
public enum Architecture
{
    X86 = 0,
    X64 = 1,
    Arm = 2,
    Arm64 = 3
}

I've decorated my function to include a parameter definition like so...

[OpenApiParameter(name: "architecture", In = ParameterLocation.Query, Required = false, Type = typeof(Architecture))]

The resulting OpenAPI definition comes out like so...

{
    "name": "architecture",
    "in": "query",
    "schema": {
        "type": "integer",
        "format": "int32"
    }
}

What am I missing there to get the parameter to report that it's an enum and its allowed values instead of int?

Thanks,
Michael

@michaelstaszewski Thanks for your comment!

Just to confirm, do you also have the same issue when your enum is a part of the request/response payload?

Please refer to the discussion at #75