-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Improve endpoint metadata debugging #48207
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
JamesNK
merged 27 commits into
main
from
SeanFarrow-feature/sf/39792-improve-endpoint-metadata-debugging
May 19, 2023
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
bbd0058
Override the ToString method in the DataTokensMetadata class.
SeanFarrow 6252be4
Override the ToString method in the EndpointNameMetadata class.
SeanFarrow 9bcccae
Override the ToString method in the HostAttribute class.
SeanFarrow ae62eec
Use the overridden ToString method of the HostAttribute class rather …
SeanFarrow c622400
Override the ToString method in the HttpMethodMetadata class.
SeanFarrow 2810c06
Use the ToString method of the HttpMethodMetadata for debugging and r…
SeanFarrow b4e3786
Override the ToString method in the RouteNameMetadata class.
SeanFarrow 19e069c
Use the newly implemented ToString method instead of DebuggerToString…
SeanFarrow a388d8e
Override the ToString method in the SuppressLinkGenerationMetadata cl…
SeanFarrow 3cf3bb1
Override the ToString method in the SuppressMatchingMetadata class.
SeanFarrow 1dcbd3f
Update the ToString method of the DataTokensMetadata class to remove …
SeanFarrow 9000058
Override the ToString method in the DataTokensMetadata class.
SeanFarrow fc093b2
Override the ToString method in the HostAttribute class.
SeanFarrow 1c2cc7f
Override the ToString method in the HttpMethodMetadata class.
SeanFarrow 17ec7f6
Override the ToString method in the RouteNameMetadata class.
SeanFarrow 4f2b05a
Update the ToString method of the DataTokensMetadata class to remove …
SeanFarrow 72d493e
Clean up, collection proxy, extra attributes
JamesNK ee43ced
Update
JamesNK 9fece53
Tests
JamesNK abe4ece
Add more attributes
JamesNK 6fdf4a1
Fix build
JamesNK 2c8d162
Fix tests
JamesNK a3acf62
Fix test
JamesNK 1e69c9a
Update
JamesNK 4af1ea4
PR feedback
JamesNK cf99e7f
Add debugger helper
JamesNK ca2b203
Update
JamesNK 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
File renamed without changes.
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
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,48 @@ | ||
// 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; | ||
|
||
public class MetadataTest | ||
{ | ||
[Fact] | ||
public void EndpointDescriptionAttribute_ToString() | ||
{ | ||
// Arrange | ||
var metadata = new EndpointDescriptionAttribute("A description"); | ||
|
||
// Act | ||
var value = metadata.ToString(); | ||
|
||
// Assert | ||
Assert.Equal("Description: A description", value); | ||
} | ||
|
||
[Fact] | ||
public void EndpointSummaryAttribute_ToString() | ||
{ | ||
// Arrange | ||
var metadata = new EndpointSummaryAttribute("A summary"); | ||
|
||
// Act | ||
var value = metadata.ToString(); | ||
|
||
// Assert | ||
Assert.Equal("Summary: A summary", value); | ||
} | ||
|
||
[Fact] | ||
public void HostAttribute_ToString() | ||
{ | ||
// Arrange | ||
var metadata = new TagsAttribute("Tag1", "Tag2"); | ||
|
||
// Act | ||
var value = metadata.ToString(); | ||
|
||
// Assert | ||
Assert.Equal("Tags: Tag1,Tag2", value); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Diagnostics; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Shared; | ||
|
||
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)] | ||
[DebuggerDisplay("{ToString(),nq}")] | ||
public sealed class ExcludeFromDescriptionAttribute : Attribute, IExcludeFromDescriptionMetadata | ||
{ | ||
/// <inheritdoc /> | ||
public bool ExcludeFromDescription => true; | ||
|
||
/// <inheritdoc/>> | ||
public override string ToString() | ||
{ | ||
return DebuggerHelpers.GetDebugText(nameof(ExcludeFromDescription), ExcludeFromDescription); | ||
} | ||
} |
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
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.