-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Improve support for OpenAPI in minimal actions #34906
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
20 commits
Select commit
Hold shift + click to select a range
f0d2558
Support setting content types in ProducesResponseTypeAttribute to clo…
captainsafia e6c4335
Add WithName extension method to resolve #34538
captainsafia 74df1e3
Support setting endpoints on group names to resolve #34541
captainsafia 1eefa01
Add OpenAPI extension methods to resolve #33924
captainsafia a85aab1
Add tests for new OpenAPI methods
captainsafia d21964e
Add endpoint metadata attributes
captainsafia 57f36ec
Update PublicAPI files with deltas
captainsafia 5add623
Add support for SuppressApi to close #34068
captainsafia 3940f1f
Update tests to account for supporting setting content types
captainsafia 96cec51
Fix up PublicAPI analyzer warnings
captainsafia d5e6e73
Clean up source files
captainsafia 14dbfab
Address feedback from API review
captainsafia 5c21deb
Fix typo and update type signature
captainsafia a914a2d
Apply feedback from second API review
captainsafia 8885db7
Update docstrings
captainsafia 504b9f1
Apply suggestions from code review
captainsafia a3e4171
Address non-test related feedback
captainsafia c8a1cd9
Handle setting content types for ProducesResponseType attribute
captainsafia 63d6329
Address feedback from peer review
captainsafia 94260c4
Add test for ProducesResponseType override scenario
captainsafia 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Microsoft.AspNetCore.Routing | ||
{ | ||
/// <summary> | ||
/// Specifies the endpoint group name in <see cref="Microsoft.AspNetCore.Http.Endpoint.Metadata"/>. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate | AttributeTargets.Class, Inherited = false, AllowMultiple = false)] | ||
public sealed class EndpointGroupNameAttribute : Attribute, IEndpointGroupNameMetadata | ||
captainsafia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
/// <summary> | ||
/// Initializes an instance of the <see cref="EndpointGroupNameAttribute"/>. | ||
/// </summary> | ||
/// <param name="endpointGroupName">The endpoint group name.</param> | ||
public EndpointGroupNameAttribute(string endpointGroupName) | ||
{ | ||
if (endpointGroupName == null) | ||
{ | ||
throw new ArgumentNullException(nameof(endpointGroupName)); | ||
} | ||
|
||
EndpointGroupName = endpointGroupName; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public string EndpointGroupName { get; } | ||
} | ||
} |
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,36 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Microsoft.AspNetCore.Routing | ||
{ | ||
/// <summary> | ||
/// Specifies the endpoint name in <see cref="Endpoint.Metadata"/>. | ||
/// </summary> | ||
/// <remarks> | ||
/// Endpoint names must be unique within an application, and can be used to unambiguously | ||
/// identify a desired endpoint for URI generation using <see cref="Microsoft.AspNetCore.Routing.LinkGenerator"/> | ||
/// </remarks> | ||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)] | ||
public sealed class EndpointNameAttribute : Attribute, IEndpointNameMetadata | ||
{ | ||
/// <summary> | ||
/// Initializes an instance of the EndpointNameAttribute. | ||
/// </summary> | ||
/// <param name="endpointName">The endpoint name.</param> | ||
public EndpointNameAttribute(string endpointName) | ||
{ | ||
if (endpointName == null) | ||
{ | ||
throw new ArgumentNullException(nameof(endpointName)); | ||
} | ||
|
||
EndpointName = endpointName; | ||
} | ||
|
||
/// <inheritdoc /> | ||
public string EndpointName { get; } | ||
} | ||
} |
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,18 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Microsoft.AspNetCore.Routing | ||
{ | ||
/// <summary> | ||
/// Indicates that this <see cref="Endpoint"/> should not be included in the generated API metadata. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Delegate, AllowMultiple = false, Inherited = true)] | ||
public sealed class ExcludeFromDescriptionAttribute : Attribute, IExcludeFromDescriptionMetadata | ||
{ | ||
/// <inheritdoc /> | ||
public bool ExcludeFromDescription => true; | ||
} | ||
} |
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,18 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Microsoft.AspNetCore.Routing | ||
{ | ||
/// <summary> | ||
/// Defines a contract used to specify an endpoint group name in <see cref="Endpoint.Metadata"/>. | ||
/// </summary> | ||
public interface IEndpointGroupNameMetadata | ||
{ | ||
/// <summary> | ||
/// Gets the endpoint group name. | ||
/// </summary> | ||
string EndpointGroupName { get; } | ||
} | ||
} |
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,21 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Microsoft.AspNetCore.Routing | ||
{ | ||
/// <summary> | ||
/// Indicates whether or not that API explorer data should be emitted for this endpoint. | ||
/// </summary> | ||
public interface IExcludeFromDescriptionMetadata | ||
{ | ||
/// <summary> | ||
/// Gets a value indicating whether OpenAPI | ||
/// data should be excluded for this endpoint. If <see langword="true"/>, | ||
/// API metadata is not emitted. | ||
/// </summary> | ||
bool ExcludeFromDescription { get; } | ||
} | ||
} |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
excited about this