-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Fix self-referential schema handling for collection-based types #60339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Not sure if it helps, but here's the simplest repro I have (eliminates the nullability difference from my previous one)
Which results in the following schema:
|
I am also experiencing similar issues. In the following is a minimal example how the problem occurs in my project. I don't know if this has the same cause, maybe it helps. I created the following class in an existing project
Used it in a controller like
A part of the generated schema
|
I'm experiencing the same thing. I'm building an OTLP/HTTP receiver to handle OpenTelemetry signals. These signals have recursive, nested properties like the |
Same issue here we migrated from NSwag.AspNetCore, even the type names are messed up for us. |
@captainsafia I see your new V2 library works correctly already for dotnet 10 release. Is there a way we can get this fixed in 9 as this is a complete blocker. (unless you have a workaround) |
OK! First of all, thanks for your patience with all these $ref issues. The bug fix for this and related issues that have been duped to it has been merged with expected release in 9.0.4. I've included test cases from the feedback items left here in our coverage for it as well. These test cases are also shared with the M.OpenApi team as they work to improve reference handling in V2.
The new V2 library has much more robust handling for relative references (the kind that are causing these issues) than the current implementation. There are still some remaining issues with it, as you can see from some of the test suppressions in #60822 but we're working with the M.OpenApi team to resolve those before v2 goes GA. Since we can't consume breaking changes in .NET 9, I ended up making some tactical changes in our package to workaround some of the gaps in M.OpenApi v1.6. |
Hi. Thx for your answer. Can we have an estimate of the release date of the 9.0.4? |
Tuesday 8th April is the likely date - there's typically a new release on the second Tuesday of the month for Update Tuesday. |
@martincostello is there a pre release I can use until then? We're not in production yet, so pre release would be fine. |
You could try looking in the dotnet/sdk repo for details of a daily build for 9.0.x latest. |
I have now tried version 9.0.4. |
@oPreis-Systecs Please open a new issue with a repro for your specific issue. |
Opend an issue for this: |
I am now encountering a different ref issue on 9.0.4, as well as the afformentioned duplication bug detailed in #61408 Instead of creating an invalid ref it now generates nothing in the items object. This response type: public class Response
{
public required List<InnerResponse> Prop1 { get; set; }
public required List<InnerResponse> Prop2 { get; set; }
}
public class InnerResponse
{
} generates as: {
"Response": {
"required": [
"prop1",
"prop2"
],
"type": "object",
"properties": {
"prop1": {
"type": "array",
"items": {
"$ref": "#/components/schemas/InnerResponse"
}
},
"prop2": {
"type": "array",
"items": {}
}
}
},
"InnerResponse": {
"type": "object"
}
} |
Based on feedback from #58968 (comment) and #58968 (comment).
We need to resolve the bug for schema comparisons around the following type hierarchy:
The text was updated successfully, but these errors were encountered: