OpenAPI document generation does not generate correct refs for self-referencing collection properties #58006
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
feature-openapi
Milestone
Is there an existing issue for this?
Describe the bug
Microsoft.AspNetCore.OpenApi
will generate an invalid JSON schema when a parameter has a self-reference collection property. This does not seem to occur if the self reference is not a collection.Using the following as a parameter:
Will result in the JSON schema:
Which has an invalid reference:
This occurs with both minimal APIs and controllers.
Expected Behavior
I would expect the
subCriteria
items
reference to correctly point at#/components/schemas/Criteria
.Steps To Reproduce
Here is a complete self-contained
Program.cs
which will generate the invalid OpenAPI document:And the OpenAPI document generated at
/openapi/v1.json
:Exceptions (if any)
No response
.NET Version
9.0.100-rc.1.24452.12
Anything else?
No response
The text was updated successfully, but these errors were encountered: