azure-functions-openapi-extension icon indicating copy to clipboard operation
azure-functions-openapi-extension copied to clipboard

Bug report, feature request or other request

Open faarbaek opened this issue 3 years ago • 0 comments

Describe the issue The type name is not valid when having a type with a nullable jagged array. The type is named "list_nullable`1" in the Open API spec which cannot be imported to e.g. Azure API Management

To Reproduce The following function will produce an invalid type name in the Open API spec

[FunctionName(nameof(FunctionReturnsNullableJaggedArray))]
[OpenApiOperation(nameof(FunctionReturnsNullableJaggedArray))]
[OpenApiResponseWithBody(HttpStatusCode.OK, "application/json", typeof(NullableJaggedArray))]
public async Task<IActionResult> FunctionReturnsNullableJaggedArray([HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req)
{
    return new OkResult();
}

public class NullableJaggedArray
{
    public float?[][] Bar { get; set; }
}

The following open api spec is produced:

"definitions": {
    "list_nullable`1": {
      "type": "array",
      "items": {
        "format": "float",
        "type": "number"
      }
    },
    "nullableJaggedArray": {
      "type": "object",
      "properties": {
        "bar": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/list_nullable`1"
          }
        }
      }
    }
  }

The type list_nullable`1 cannot be imported into Azure API Management

Expected behavior A valid type is excpected (like "list_nullable_float")

Environment

  • Version 1.3.0

faarbaek avatar Jun 15 '22 13:06 faarbaek