-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add OpenAPI/Swagger support for minimal actions #33433
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
9b4d3aa
WIP
halter73 6aefae5
Add to slnf
halter73 01e31bf
WIP
halter73 681138f
AddMethodInfoApiExplorerServices
halter73 c96eb66
Start of params
halter73 c0d3e09
Add RequestDelegateFactoryUtilities
halter73 3f3f0a1
Remove BindingSource.PathOrQuery
halter73 7863bd5
Fix handling of "FromBody" params
halter73 8354c65
Start adding EndpointMethodInfoApiDescriptionProviderTests
halter73 68b9b64
rename and cleanup
halter73 155f205
Support response metadata attributes
halter73 54b2245
Use all content-types
halter73 48ee097
Set ModelMetadata when given response type for attribute
halter73 de645fe
AddSupportedRequestFormats
halter73 8a5913e
Use non-compiler-generated declaring types for "controller" name
halter73 25bb72f
Add request/response format tests
halter73 842b18a
Add BindingSource tests
halter73 c09aaba
Add more response/request format tests
halter73 9491d49
Use IServiceProviderIsService in EndpointMetadataApiDescriptionProvider
halter73 1520e4c
cleanup
halter73 03ee0a5
Rename AddEndpointsApiExplorer and fix namespace
halter73 1b53e2e
fix tests
halter73 3368d23
Use ApplicationName instead of "Map" if no declaring type
halter73 dc80513
address pr feedback
halter73 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...lorer/src/DependencyInjection/EndpointMethodInfoApiExplorerServiceCollectionExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Mvc.ApiExplorer; | ||
using Microsoft.AspNetCore.Mvc.Infrastructure; | ||
using Microsoft.Extensions.DependencyInjection.Extensions; | ||
|
||
namespace Microsoft.Extensions.DependencyInjection | ||
{ | ||
/// <summary> | ||
/// Extensions for configuring ApiExplorer using <see cref="Endpoint.Metadata"/>. | ||
/// </summary> | ||
public static class EndpointMetadataApiExplorerServiceCollectionExtensions | ||
{ | ||
/// <summary> | ||
/// Configures ApiExplorer using <see cref="Endpoint.Metadata"/>. | ||
/// </summary> | ||
/// <param name="services">The <see cref="IServiceCollection"/>.</param> | ||
public static IServiceCollection AddEndpointsApiExplorer(this IServiceCollection services) | ||
{ | ||
// Try to add default services in case MVC services aren't added. | ||
services.TryAddSingleton<IActionDescriptorCollectionProvider, DefaultActionDescriptorCollectionProvider>(); | ||
services.TryAddSingleton<IApiDescriptionGroupCollectionProvider, ApiDescriptionGroupCollectionProvider>(); | ||
|
||
services.TryAddEnumerable( | ||
ServiceDescriptor.Transient<IApiDescriptionProvider, EndpointMetadataApiDescriptionProvider>()); | ||
|
||
return services; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.