Skip to content

Conversation

@gabr0236
Copy link

@gabr0236 gabr0236 commented Dec 3, 2025

Updates the IOpenApiDocumentProvider example in
aspnetcore/fundamentals/openapi/using-openapi-documents.md to:

  • Inject the provider as a keyed service using [FromKeyedServices("v1")].
  • Call GetOpenApiDocumentAsync with an optional CancellationToken instead of a document name.
  • Note that the service key "v1" must match the name passed to AddOpenApi.

The previous sample did not compile (because GetOpenApiDocumentAsync does not take a document name parameter) and did not reflect the keyed registration used by AddOpenApi("v1").


Internal previews

📄 File 🔗 Preview link
aspnetcore/fundamentals/openapi/using-openapi-documents.md Use openAPI documents

Updates the `IOpenApiDocumentProvider` example in
`aspnetcore/fundamentals/openapi/using-openapi-documents.md` to:

* Inject the provider as a keyed service using `[FromKeyedServices("v1")]`.
* Call `GetOpenApiDocumentAsync` with an optional `CancellationToken` instead of a document name.
* Note that the service key `"v1"` must match the name passed to `AddOpenApi`.

The previous sample did not compile and did not reflect the keyed registration used by `AddOpenApi("v1")`.
@gabr0236
Copy link
Author

gabr0236 commented Dec 3, 2025

@captainsafia FYI

@guardrex guardrex requested a review from captainsafia December 3, 2025 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant