Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comment to OpenApiDocumentProvider #57061

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

martincostello
Copy link
Member

Add comment to OpenApiDocumentProvider

Add a comment explaining what the OpenApiDocumentProvider class is for.

Description

I was looking through the code to see if it was possible for the new OpenAPI library to output YAML instead of JSON yet (context: #54598 (comment)), and at first I thought OpenApiDocumentProvider was only used by tests, so it seemed redundant.

Then I found this comment:

// Required for build-time generation
services.AddSingleton<IDocumentProvider, OpenApiDocumentProvider>();

This PR adds a class-level summary explaining what the purpose of the internal class is, as otherwise it seems unused (it's accessed through reflection here):

private const string DocumentService = "Microsoft.Extensions.ApiDescriptions.IDocumentProvider";

Type serviceType = null;
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
serviceType = assembly.GetType(DocumentService, throwOnError: false);
if (serviceType != null)
{
break;
}
}
if (serviceType == null)
{
_reporter.WriteError(Resources.FormatServiceTypeNotFound(DocumentService));
return false;
}

Add a comment explaining what the `OpenApiDocumentProvider` class is for.
@martincostello martincostello requested review from captainsafia and a team as code owners July 29, 2024 14:26
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jul 29, 2024
@martincostello martincostello added feature-openapi old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels and removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Jul 29, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jul 29, 2024
@captainsafia captainsafia enabled auto-merge (squash) July 29, 2024 14:49
@captainsafia captainsafia merged commit f0120ae into dotnet:main Jul 29, 2024
26 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-rc1 milestone Jul 29, 2024
@martincostello martincostello deleted the patch-2 branch July 29, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Indicates that the PR has been added by a community member feature-openapi old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants