OpenAPI Document Generation repeated types across multiple unrelated records not generating type in schema #61527
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
feature-openapi
Is there an existing issue for this?
Describe the bug
When properties of two unrelated types share the same type, OpenAPI document generation does not assign types to one of them. This applies if both unrelated types are returned from the same minimal api endpoint. For example: If there was a record MapNode, and record MapLink, and two different records had Collections of each, regardless of what the property name is, one of the two different records will not generate correctly.
This does not happen if MapNode and MapLink are not in Collections. I have tested with Lists and Arrays.
To show:
If OverallDataContainer was returned by an endpoint, DataContainer1 generates an openApi schema correctly, while DataContainer2 does not:
Current workaround: Split MapNode and MapLink into different types per record (Container1MapNode, Container1MapLink, Container2MapNode, and Container2MapLink)
Expected Behavior
Expected behaviour would be that container2MapNodes and container2MapLinks share the same properties as container1MapNodes and containter1MapLinks:
Steps To Reproduce
Github repo which reproduces the issue
Exceptions (if any)
No response
.NET Version
9.0.203
Anything else?
Microsoft.AspNetCore.OpenApi version 9.0.4 - This is also an issue when downgraded to version 9.0
Scalar.AspNetCore version 2.1.16
Running on Visual Studio Community 2022 v17.13.6
The text was updated successfully, but these errors were encountered: