-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
We are looking into replacing Swashbuckle with the new OpenApi functionality. We have created a sample application to see what is different in the generated schema. I discovered one difference I can't explain.
We have a controller that uses this object structure
public class EchoData
{
public EchoData2? Level2 { get; set; }
}
public class EchoData2
{
public EchoData3? Level3 { get; set; }
}
public class EchoData3
{
public string Something { get; set; } = default!;
}
In the generated json, the EchoData3 is inlined into EchoData2. This doesn't seem right.
"components": {
"schemas": {
"EchoData": {
"type": "object",
"properties": {
"level2": {
"$ref": "#/components/schemas/EchoData2"
}
}
},
"EchoData2": {
"type": "object",
"properties": {
"level3": {
"type": "object",
"properties": {
"something": {
"type": "string"
}
},
"nullable": true
}
},
"nullable": true
}
}
},
Expected Behavior
I would expect a schema entry for every class being used. When using code generation tools, naming this inline object becomes tricky.
Steps To Reproduce
Check out code at: https://github.com/dnv-kimbell/openapi-inlineschema
Exceptions (if any)
No response
.NET Version
9.0 RC1
Anything else?
No response
Metadata
Metadata
Assignees
Labels
area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi