Skip to content

Reduce reliance on ApiExplorer types for Microsoft.AspNetCore.OpenApi consumption #44209

Closed
@captainsafia

Description

@captainsafia

In .NET 7, we introduced the new Microsoft.AspNetCore.OpenApi package that generates an OpenApiOperation definition for a given minimal endpoint and its metadata. One of the goals of this package was to remove the reliance on ApiExplorer and it's types that existed in the current implementation for OpenAPI definitions.

Currently, even if a user is using WithOpenApi exclusively to document their endpoints they still have to include the following in their application to register the minimal API-specific implementations of ApiExplorer.

builder.Services.AddEndpointsApiExplorer();

Open source dependencies like Swashbuckle and NSwag still rely on ApiExplorer-specific types, like IApiDescriptionGroupCollectionProvider, to determine all of the endpoints that are associated with an application. Reducing the reliance on this type for minimal API scenarios in particular would allow us to remove the AddEndpointsApiExplorer from the template.

There's a chance that if we do #44192, then we wouldn't need to find a different way to derive all the endpoints in an application and can instead use the OpenApiDocument directly as the source of truth.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions