-
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
If you have xml comments with multiple response codes, only the first one is translated.
/// <summary>
/// Retrieves a specific project board by ID.
/// </summary>
/// <param name="id">The ID of the project board to retrieve.</param>
/// <returns>The requested project board.</returns>
/// <response code="200">Returns the requested project board.</response>
/// <response code="404">If the project board is not found.</response>
public static IResult GetProjectBoardById(int id)
{
var board = Boards.FirstOrDefault(b => b.Id == id);
if (board == null)
{
return Results.NotFound();
}
return Results.Ok(board);
}
{
"openapi": "3.1.1",
"info": {
"title": "Api | v1",
"version": "1.0.0"
},
"servers": [
{
"url": "http://localhost:5052"
}
],
"paths": {
"/api/projectboards": {
"get": {
"tags": [
"Project Boards"
],
"summary": "Retrieves all project boards.",
"responses": {
"200": {
"description": "Returns the list of project boards."
}
}
},
"post": {
"tags": [
"Project Boards"
],
"summary": "Creates a new project board.",
"requestBody": {
"description": "The project board to create.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProjectBoard"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/projectboards/{id}": {
"get": {
"tags": [
"Project Boards"
],
"summary": "Retrieves a specific project board by ID.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The ID of the project board to retrieve.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "Returns the requested project board."
}
}
},
"put": {
"tags": [
"Project Boards"
],
"summary": "Updates an existing project board.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The ID of the project board to update.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
}
],
"requestBody": {
"description": "The updated project board data.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProjectBoard"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK"
}
}
},
"delete": {
"tags": [
"Project Boards"
],
"summary": "Deletes a project board.",
"parameters": [
{
"name": "id",
"in": "path",
"description": "The ID of the project board to delete.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/projectboards/{boardId}/todos": {
"get": {
"tags": [
"Todos"
],
"summary": "Retrieves all todos for a specific project board. INFOMEDIA",
"parameters": [
{
"name": "boardId",
"in": "path",
"description": "The ID of the project board.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "Returns the list of todos."
}
}
},
"post": {
"tags": [
"Todos"
],
"summary": "Creates a new todo within a project board.",
"parameters": [
{
"name": "boardId",
"in": "path",
"description": "The ID of the project board.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
}
],
"requestBody": {
"description": "The todo to create.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Todo"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/projectboards/{boardId}/todos/{id}": {
"get": {
"tags": [
"Todos"
],
"summary": "Retrieves a specific todo by ID within a project board.",
"parameters": [
{
"name": "boardId",
"in": "path",
"description": "The ID of the project board.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
},
{
"name": "id",
"in": "path",
"description": "The ID of the todo to retrieve.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "Returns the requested todo."
}
}
},
"put": {
"tags": [
"Todos"
],
"summary": "Updates an existing todo within a project board.",
"parameters": [
{
"name": "boardId",
"in": "path",
"description": "The ID of the project board.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
},
{
"name": "id",
"in": "path",
"description": "The ID of the todo to update.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
}
],
"requestBody": {
"description": "The updated todo data.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Todo"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK"
}
}
},
"delete": {
"tags": [
"Todos"
],
"summary": "Deletes a todo from a project board.",
"parameters": [
{
"name": "boardId",
"in": "path",
"description": "The ID of the project board.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
},
{
"name": "id",
"in": "path",
"description": "The ID of the todo to delete.",
"required": true,
"schema": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"components": {
"schemas": {
"ProjectBoard": {
"type": "object",
"properties": {
"id": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"description": "Unique identifier for the project board.",
"format": "int32"
},
"name": {
"type": "string",
"description": "The name of the project board."
},
"description": {
"type": [
"null",
"string"
],
"description": "A description of the project board and its purpose."
},
"createdAt": {
"type": "string",
"description": "The date when the project board was created.",
"format": "date-time"
},
"todos": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Todo"
},
"description": "The collection of todos associated with this project board."
}
},
"description": "Represents a project board containing todos and related information."
},
"Todo": {
"type": "object",
"properties": {
"id": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"description": "Unique identifier for the todo item.",
"format": "int32"
},
"title": {
"type": "string",
"description": "The title or brief description of the todo."
},
"description": {
"type": [
"null",
"string"
],
"description": "A detailed description of the todo item."
},
"isComplete": {
"type": "boolean",
"description": "Indicates whether the todo has been completed."
},
"priority": {
"$ref": "#/components/schemas/TodoPriority"
},
"createdAt": {
"type": "string",
"description": "The date when the todo was created.",
"format": "date-time"
},
"dueDate": {
"type": [
"null",
"string"
],
"description": "The date when the todo is due to be completed.",
"format": "date-time"
},
"projectBoardId": {
"pattern": "^-?(?:0|[1-9]\\d*)$",
"type": [
"integer",
"string"
],
"description": "The ID of the project board this todo belongs to.",
"format": "int32"
}
},
"description": "Represents a todo item within a project board."
},
"TodoPriority": {
"type": "integer",
"description": "Represents the priority level of a todo item."
}
}
},
"tags": [
{
"name": "Project Boards"
},
{
"name": "Todos"
}
]
}
Expected Behavior
All responses should be written to the json
Steps To Reproduce
full reproduction from example in official docs https://github.com/captainsafia/aspnet-openapi-xml/blob/670f571f6d22559e728f3e0e6046100761dfcb0a/api/ProjectBoardApis.cs
Exceptions (if any)
No response
.NET Version
dotnet 10 preview 2 and preview 3
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