Microsoft.AspNetCore.OpenApi generates a class that does not exist but is like a other class with a number added to the end of the name #59677
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
I have asp dotnet 9.0 project.
I use
Microsoft.AspNetCore.OpenApi
to generate OpenAPI and useScalar
andSwaggerUI
to show it.my project file is
and there are
Monitoring
api and class like this:The API return
MonitoringRoot
that has multiMonitoringItem
.and
program.cs
is:API works OK. but when I see swagger, there is wrong data!
and (??!!!!):
also original json has wrong:
There is
MonitoringItem2
is json (generated by OpenAPI) but there is not in my code.NOTE:
MonitoringItem2
is exactly likeMonitoringItem
.NOTE: If add
Item3
,Item4
, ... toMonitoringRoot
, generateMonitoringItem3
,MonitoringItem3
, .... .NOTE: I checked and found that the below code was causing this problem:
so I remove array, everything is OK! like this:
Expected Behavior
No generate extra data and I see:
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.100
Anything else?
I use Microsoft Visual Studio Community 2022 (64-bit) Version 17.12.2 in windows 10 22H2.
The text was updated successfully, but these errors were encountered: