Add ILoggerFactory-injection to ApiDescriptionGroupCollectionProvider
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
## Background and Motivation
To improve the diagnosability of the OpenAPI layer, we'd like to provide logs so that users can understand what components are contributing custom `IApiDescriptionProvider` implementations to the `ApiExplorer` layer. In order to support this scenario, we need to support injecting an `ILoggerFactory` instance to the `ApiDescriptionGroupCollectionProvider` class that invokes all the discovered `IApiDescriptionProvider` instances.
## Proposed API
```diff
- public class ApiDescriptionGroupCollectionProvider : IApiDescriptionGroupCollectionProvider
+ public partial class ApiDescriptionGroupCollectionProvider : IApiDescriptionGroupCollectionProvider
{
+ public ApiDescriptionGroupCollectionProvider(
+ IActionDescriptorCollectionProvider actionDescriptorCollectionProvider,
+ IEnumerable apiDescriptionProviders,
+ ILoggerFactory loggerFactory)
}
```
## Alternative Designs
- Add a new internal-only implementation of `ApiDescriptionGroupCollectionProvider` and support `ILoggerFactory` injection in its constructors.
Contributor guide
Research direction
Locate ApiDescriptionGroupCollectionProvider and the IApiDescriptionProvider implementations it invokes. Review how the provider is constructed and how ApiExplorer contributions are discovered, then determine the expected logging behavior for identifying contributing components. Done means ILoggerFactory injection is supported and the OpenAPI layer emits useful diagnostics for those providers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100