Closed null-d3v closed 1 month ago
@null-d3v Thanks for reporting this issue!
I'm hoping to drop a fix for this in the upcoming .NET 9 GA release. Once the change is merged, you can try out the fix in one of our nightly releases of the package. If you're interested in learning how to do that, let me know and I can share instructions.
@captainsafia Thanks for the prompt reply!! I haven't had to pull from the nightly feed yet, but I've worked out the setup. Very enthused about this in .NET 9! We have a lot of document generation with NSwag that we're anticipating to change.
@null-d3v The fix for this has landed in nightly package version 9.0.0-rtm.24476.2
.
You'll need to use the following PackageReference
:
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0-rtm.24476.2" />
And make sure that you have a reference to the nightly dotnet9 feed in your nuget.config
file:
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
Can you verify the fix on your end?
Sorry for the late reply, this is definitely fixed in 9.0.0-rtm.24476.2
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