Open Chrille79 opened 1 week ago
Use JsonIgnore for Circular Property
or Use a Custom Schema Filter (builder.Services.AddSwaggerGen(c =>
{
c.SchemaFilter
Use JsonIgnore for Circular Property or Use a Custom Schema Filter (builder.Services.AddSwaggerGen(c => { c.SchemaFilter(); }); )
This is Microsoft.Openapi and the reference in schema are not RFC3986 compliant. To use AddSwaggerGen from swashbuckle is a workaround, but not a fix on the bug
It doesn't even have to cycle. It's enough to reference the same class twice in two different collections.
public class WeatherForecast
{
// Having "Update" in two lists causes the bug to surface.
public List<Update> RainUpdates { get; set; }
public List<Update> HurricaneUpdates { get; set; }
}
public sealed class Update
{
public DateOnly Date { get; set; }
public string Message { get; set; }
}
Hitting same issue without cycles. Likely related to https://github.com/dotnet/aspnetcore/issues/58968.
Is there an existing issue for this?
Describe the bug
If you have an model with types as following Person->Address->Person The referens get invalid and doesnt point to a type in components
"$ref": "#/components/schemas/#/properties/myAddress/properties/mailOfficer"
Expected Behavior
$refs must reference a valid location in the document
Steps To Reproduce
Example application
Schema output
Exceptions (if any)
No response
.NET Version
9.0.100
Anything else?
No response