Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions aspnetcore/fundamentals/openapi/using-openapi-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Learn how to use OpenAPI documents in an ASP.NET Core app.
ms.author: safia
monikerRange: '>= aspnetcore-6.0'
ms.custom: mvc
ms.date: 08/04/2025
ms.date: 12/04/2025
uid: fundamentals/openapi/using-openapi-documents
---
# Use openAPI documents
Expand Down Expand Up @@ -105,11 +105,11 @@ The output shows any issues with the OpenAPI document. For example:
You can inject <xref:Microsoft.AspNetCore.OpenApi.IOpenApiDocumentProvider> into your services through dependency injection to access OpenAPI documents programmatically, even outside HTTP request contexts.

```csharp
public class DocumentService
public class CustomDocumentService
{
private readonly IOpenApiDocumentProvider _documentProvider;

public DocumentService(IOpenApiDocumentProvider documentProvider)
public CustomDocumentService(IOpenApiDocumentProvider documentProvider)
{
_documentProvider = documentProvider;
}
Expand All @@ -124,7 +124,7 @@ public class DocumentService
Register the service in your DI container:

```csharp
builder.Services.AddScoped<DocumentService>();
builder.Services.AddScoped<CustomDocumentService>();
```

This enables scenarios such as generating client SDKs, validating API contracts in background processes, or exporting documents to external systems.
Expand Down