Skip to content

Byte Array in response body is failing to render swagger #150

@kotac24

Description

@kotac24

Hi,
Using Http trigger function with Open Api integration, Swagger UI will fail to render if there is a byte[] type in your response.
Very easy to reproduce, create a new Http trigger project with open API integration. Decorate your function with something like:
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(TestResponse), Description = "The OK response")]
And make sure TestResponse has a byte array.
public class TestResponse { public byte[] TestContent { get; set; } }

By navigating to swagger UI you get: "Failed to load API definition".
Trying to load swagger.json manually throws: "Sequence contains no elements" error.
Am i missing something obvious or is there any quick workaround for this ?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions