-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Describe the bug
For the following Type:
using System.ComponentModel;
namespace ManagementApiServer.Models;
public record DynamicTableDataPatch()
{
[Description("List of records to delete. Only the first column (primary key) is considered for deletion.")]
public List<List<string>> Delete { get; set; } = [];
[Description("List of records to add or update.")]
public List<List<string>> AddOrUpdate { get; set; } = [];
}
a wrong (at least neither swagger ui nor scalar can handle it) reference is created for the second occurance of List<List>
OpenApi File To Reproduce
{
"openapi": "3.0.1",
"info": {
"title": "ManagementApiServer | v1",
"version": "1.0.0"
},
"servers": [
{
"url": "https://localhost:7093"
},
{
"url": "http://localhost:5192"
}
],
"paths": {
"/managementApi/v1/dynamicTables/{id}": {
"patch": {
"tags": [
"ManagementApiServer"
],
"description": "Performs an atomic update operation on the specified records, ensuring all changes are applied together or not at all.",
"operationId": "PatchDynamicTable",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DynamicTableDataPatch"
}
}
},
"required": true
},
"responses": {
"204": {
"description": "No Content"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
}
}
},
"get": {
"tags": [
"ManagementApiServer"
],
"operationId": "GetDynamicTable",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
},
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
}
}
},
"/managementApi/v1/dynamicTables": {
"get": {
"tags": [
"ManagementApiServer"
],
"operationId": "GetDynamicTables",
"responses": {
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
},
"500": {
"description": "Internal Server Error"
},
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/DynamicTable"
}
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"DynamicTable": {
"required": [
"name",
"dynamicTableDefinitionId",
"created",
"modifed"
],
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"name": {
"type": "string"
},
"dynamicTableDefinitionId": {
"type": "string",
"format": "uuid"
},
"description": {
"type": "string"
},
"created": {
"type": "string",
"format": "date-time"
},
"modifed": {
"type": "string",
"format": "date-time"
}
}
},
"DynamicTableDataPatch": {
"type": "object",
"properties": {
"delete": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
},
"description": "List of records to delete. Only the first column (primary key) is considered for deletion."
},
"addOrUpdate": {
"type": "array",
"items": {
"$ref": "#/components/schemas/#/properties/delete/items"
},
"description": "List of records to add or update."
}
}
}
},
"securitySchemes": {
"ApiKeyAuth": {
"type": "apiKey",
"description": "Custom authentication header",
"name": "Api-Key",
"in": "header"
}
}
},
"tags": [
{
"name": "ManagementApiServer"
}
]
}
Expected Behavior
Expected behavior
The reference seems invalid.
At least neither scalar nor swagger-ui can handle it.
swagger ui reports a invalid reference.
if i change the second # to the actual Name it works:
Steps To Reproduce
Using a class with List<> seems to result in this wrong reference:
app.MapPatch("/test1234", async ([FromBody] DynamicTableDataPatch records) =>
{
// ....
return Results.NoContent();
})
.Produces(204)
.Produces(403)
.Produces(404)
.Produces(500)
.Accepts<DynamicTableDataPatch>(contentType: "application/json")
.WithOpenApi();
using System.ComponentModel;
namespace ManagementApiServer.Models;
public record DynamicTableDataPatch()
{
[Description("List of records to delete. Only the first column (primary key) is considered for deletion.")]
public List<List<string>> Delete { get; set; } = [];
[Description("List of records to add or update.")]
public List<List<string>> AddOrUpdate { get; set; } = [];
}
Exceptions (if any)
No response
.NET Version
9.0.200
Anything else?
9.0.2 of the nuget package
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