Open
Description
Here is a code sample to reproduce the issue:
public class Function1
{
private const string ContentType = "application/json";
public List<Book> Lib { get; set; } = new List<Book>();
[FunctionName(nameof(AddBook))]
[OpenApiOperation(operationId: nameof(AddBook), Visibility = OpenApiVisibilityType.Important)]
[OpenApiRequestBody(contentType: ContentType, bodyType: typeof(Book), Required = true)]
[OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: ContentType, bodyType: typeof(List<Book>))]
public IActionResult AddBook([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)][FromBody] Book req, ILogger log)
{
Lib.Add(req);
return new OkObjectResult(Lib);
}
}
public class Book
{
public string Name { get; set; }
public DateTime PublicationDate { get; set; }
public Author Author { get; set; }
}
public class Author
{
public string Name { get; set; }
public List<Book> Books { get; set; }
}
It seems like recursion happens in Visit method of ObjectTypeVisitor class.
The same can be reproduced in Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3IoC project by adding a new class Owner:
public class Owner
{
public string Name { get; set; }
public List<Pet> Pets { get; set; }
}
And introducing new property "public Owner Owner { get; set; }" in Pet class