Skip to content

openAPI Document Generation doesn't include endpoints outside of Program.cs #59570

Closed as duplicate of#44970
@wolfgang-hartl

Description

@wolfgang-hartl

Hey there,

I've already mentioned it here (For reference). I'm facing an Issue where Endpoints, which are registered outside of the Program.cs don't get included in the generated .json file.

I've created a Repo for reproduction, you can find it here on Github.

Dotnet-Version: 9.0.101

The generated .json File looks like this, which is missing the endpoints in the Todo.csfile.

{
  "openapi": "3.0.1",
  "info": {
    "title": "api-dotnet | v1",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://localhost:5190"
    }
  ],
  "paths": {
    "/": {
      "get": {
        "tags": [
          "api-dotnet"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/hello/{id}": {
      "get": {
        "tags": [
          "api-dotnet"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": { },
  "tags": [
    {
      "name": "api-dotnet"
    }
  ]
}

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions