Skip to content

Commit ae7b22f

Browse files
authored
Prefix new types with 'Endpoint'
1 parent a4ac22d commit ae7b22f

File tree

8 files changed

+29
-29
lines changed

8 files changed

+29
-29
lines changed

src/Http/Http.Abstractions/src/Metadata/IDescriptionMetadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Http.Metadata;
66
/// <summary>
77
/// Defines a contract used to specify a description in <see cref="Endpoint.Metadata"/>.
88
/// </summary>
9-
public interface IDescriptionMetadata
9+
public interface IEndpointDescriptionMetadata
1010
{
1111
/// <summary>
1212
/// Gets the description associated with the endpoint.

src/Http/Http.Abstractions/src/Metadata/ISummaryMetadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Http.Metadata;
66
/// <summary>
77
/// Defines a contract used to specify a summary in <see cref="Endpoint.Metadata"/>.
88
/// </summary>
9-
public interface ISummaryMetadata
9+
public interface IEndpointSummaryMetadata
1010
{
1111
/// <summary>
1212
/// Gets the summary associated with the endpoint.

src/Http/Http.Abstractions/src/PublicAPI.Unshipped.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Microsoft.AspNetCore.Http.Metadata.IFromFormMetadata
44
Microsoft.AspNetCore.Http.Metadata.IFromFormMetadata.Name.get -> string?
55
abstract Microsoft.AspNetCore.Http.HttpResponse.ContentType.get -> string?
66
Microsoft.AspNetCore.Http.Metadata.ISkipStatusCodePagesMetadata
7-
Microsoft.AspNetCore.Http.Metadata.IDescriptionMetadata
8-
Microsoft.AspNetCore.Http.Metadata.IDescriptionMetadata.Description.get -> string!
9-
Microsoft.AspNetCore.Http.Metadata.ISummaryMetadata
10-
Microsoft.AspNetCore.Http.Metadata.ISummaryMetadata.Summary.get -> string!
7+
Microsoft.AspNetCore.Http.Metadata.IEndpointDescriptionMetadata
8+
Microsoft.AspNetCore.Http.Metadata.IEndpointDescriptionMetadata.Description.get -> string!
9+
Microsoft.AspNetCore.Http.Metadata.IEndpointSummaryMetadata
10+
Microsoft.AspNetCore.Http.Metadata.IEndpointSummaryMetadata.Summary.get -> string!

src/Http/Http.Extensions/src/DescriptionAttribute.cs renamed to src/Http/Http.Extensions/src/EndpointDescriptionAttribute.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ namespace Microsoft.AspNetCore.Http;
1414
/// behavior.
1515
/// </remarks>
1616
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)]
17-
public sealed class DescriptionAttribute : Attribute, IDescriptionMetadata
17+
public sealed class EndpointDescriptionAttribute : Attribute, IEndpointDescriptionMetadata
1818
{
1919
/// <summary>
20-
/// Initializes an instance of the <see cref="DescriptionAttribute"/>.
20+
/// Initializes an instance of the <see cref="EndpointDescriptionAttribute"/>.
2121
/// </summary>
2222
/// <param name="description">The description associated with the endpoint or parameter.</param>
23-
public DescriptionAttribute(string description)
23+
public EndpointDescriptionAttribute(string description)
2424
{
2525
Description = description;
2626
}

src/Http/Http.Extensions/src/SummaryAttribute.cs renamed to src/Http/Http.Extensions/src/EndpointSummaryAttribute.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ namespace Microsoft.AspNetCore.Http;
99
/// Specifies a summary in <see cref="Endpoint.Metadata"/>.
1010
/// </summary>
1111
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)]
12-
public sealed class SummaryAttribute : Attribute, ISummaryMetadata
12+
public sealed class EndpointSummaryAttribute : Attribute, IEndpointSummaryMetadata
1313
{
1414
/// <summary>
15-
/// Initializes an instance of the <see cref="SummaryAttribute"/>.
15+
/// Initializes an instance of the <see cref="EndpointSummaryAttribute"/>.
1616
/// </summary>
1717
/// <param name="summary">The summary associated with the endpoint or parameter.</param>
18-
public SummaryAttribute(string summary)
18+
public EndpointSummaryAttribute(string summary)
1919
{
2020
Summary = summary;
2121
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#nullable enable
22
Microsoft.Extensions.DependencyInjection.RouteHandlerJsonServiceExtensions
33
static Microsoft.Extensions.DependencyInjection.RouteHandlerJsonServiceExtensions.ConfigureRouteHandlerJsonOptions(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action<Microsoft.AspNetCore.Http.Json.JsonOptions!>! configureOptions) -> Microsoft.Extensions.DependencyInjection.IServiceCollection!
4-
Microsoft.AspNetCore.Http.DescriptionAttribute
5-
Microsoft.AspNetCore.Http.DescriptionAttribute.DescriptionAttribute(string! description) -> void
6-
Microsoft.AspNetCore.Http.DescriptionAttribute.Description.get -> string!
7-
Microsoft.AspNetCore.Http.SummaryAttribute
8-
Microsoft.AspNetCore.Http.SummaryAttribute.SummaryAttribute(string! summary) -> void
9-
Microsoft.AspNetCore.Http.SummaryAttribute.Summary.get -> string!
4+
Microsoft.AspNetCore.Http.EndpointDescriptionAttribute
5+
Microsoft.AspNetCore.Http.EndpointDescriptionAttribute.EndpointDescriptionAttribute(string! description) -> void
6+
Microsoft.AspNetCore.Http.EndpointDescriptionAttribute.Description.get -> string!
7+
Microsoft.AspNetCore.Http.EndpointSummaryAttribute
8+
Microsoft.AspNetCore.Http.EndpointSummaryAttribute.EndpointSummaryAttribute(string! summary) -> void
9+
Microsoft.AspNetCore.Http.EndpointSummaryAttribute.Summary.get -> string!

src/Http/Routing/src/Builder/OpenApiRouteHandlerBuilderExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,28 +210,28 @@ public static RouteHandlerBuilder Accepts(this RouteHandlerBuilder builder,
210210
}
211211

212212
/// <summary>
213-
/// Adds <see cref="IDescriptionMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
213+
/// Adds <see cref="IEndpointDescriptionMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
214214
/// produced by <paramref name="builder"/>.
215215
/// </summary>
216216
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
217217
/// <param name="description">A string representing a detailed description of the endpoint.</param>
218218
/// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the endpoint.</returns>
219219
public static RouteHandlerBuilder WithDescription(this RouteHandlerBuilder builder, string description)
220220
{
221-
builder.WithMetadata(new DescriptionAttribute(description));
221+
builder.WithMetadata(new EndpointDescriptionAttribute(description));
222222
return builder;
223223
}
224224

225225
/// <summary>
226-
/// Adds <see cref="ISummaryMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
226+
/// Adds <see cref="IEndpointSummaryMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
227227
/// produced by <paramref name="builder"/>.
228228
/// </summary>
229229
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
230230
/// <param name="summary">A string representation a brief description of the endpoint.</param>
231231
/// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the endpoint.</returns>
232232
public static RouteHandlerBuilder WithSummary(this RouteHandlerBuilder builder, string summary)
233233
{
234-
builder.WithMetadata(new SummaryAttribute(summary));
234+
builder.WithMetadata(new EndpointSummaryAttribute(summary));
235235
return builder;
236236
}
237237

src/Mvc/Mvc.ApiExplorer/test/EndpointMetadataApiDescriptionProviderTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ public void TestParameterIsRequiredForObliviousNullabilityContext()
513513
[Fact]
514514
public void TestParameterAttributesCanBeInspected()
515515
{
516-
var apiDescription = GetApiDescription(([System.ComponentModel.Description("The name.")] string name) => { });
516+
var apiDescription = GetApiDescription(([Description("The name.")] string name) => { });
517517
Assert.Equal(1, apiDescription.ParameterDescriptions.Count);
518518

519519
var nameParam = apiDescription.ParameterDescriptions[0];
@@ -530,7 +530,7 @@ public void TestParameterAttributesCanBeInspected()
530530

531531
Assert.NotNull(descriptor.ParameterInfo);
532532

533-
var description = Assert.Single(descriptor.ParameterInfo.GetCustomAttributes<System.ComponentModel.DescriptionAttribute>());
533+
var description = Assert.Single(descriptor.ParameterInfo.GetCustomAttributes<DescriptionAttribute>());
534534

535535
Assert.NotNull(description);
536536
Assert.Equal("The name.", description.Description);
@@ -1168,11 +1168,11 @@ public void HandlesEndpointWithDescriptionAndSummary_WithExtensionMethods()
11681168
var apiDescription = Assert.Single(context.Results);
11691169
Assert.NotEmpty(apiDescription.ActionDescriptor.EndpointMetadata);
11701170

1171-
var descriptionMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IDescriptionMetadata>().SingleOrDefault();
1171+
var descriptionMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IEndpointDescriptionMetadata>().SingleOrDefault();
11721172
Assert.NotNull(descriptionMetadata);
11731173
Assert.Equal("A description", descriptionMetadata.Description);
11741174

1175-
var summaryMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<ISummaryMetadata>().SingleOrDefault();
1175+
var summaryMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IEndpointSummaryMetadata>().SingleOrDefault();
11761176
Assert.NotNull(summaryMetadata);
11771177
Assert.Equal("A summary", summaryMetadata.Summary);
11781178
}
@@ -1181,7 +1181,7 @@ public void HandlesEndpointWithDescriptionAndSummary_WithExtensionMethods()
11811181
public void HandlesEndpointWithDescriptionAndSummary_WithAttributes()
11821182
{
11831183
var builder = CreateBuilder();
1184-
builder.MapGet("/api/todos/{id}", [Summary("A summary")][Http.Description("A description")] (int id) => "");
1184+
builder.MapGet("/api/todos/{id}", [EndpointSummary("A summary")][EndpointDescription("A description")] (int id) => "");
11851185

11861186
var context = new ApiDescriptionProviderContext(Array.Empty<ActionDescriptor>());
11871187

@@ -1199,11 +1199,11 @@ public void HandlesEndpointWithDescriptionAndSummary_WithAttributes()
11991199
var apiDescription = Assert.Single(context.Results);
12001200
Assert.NotEmpty(apiDescription.ActionDescriptor.EndpointMetadata);
12011201

1202-
var descriptionMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IDescriptionMetadata>().SingleOrDefault();
1202+
var descriptionMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IEndpointDescriptionMetadata>().SingleOrDefault();
12031203
Assert.NotNull(descriptionMetadata);
12041204
Assert.Equal("A description", descriptionMetadata.Description);
12051205

1206-
var summaryMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<ISummaryMetadata>().SingleOrDefault();
1206+
var summaryMetadata = apiDescription.ActionDescriptor.EndpointMetadata.OfType<IEndpointSummaryMetadata>().SingleOrDefault();
12071207
Assert.NotNull(summaryMetadata);
12081208
Assert.Equal("A summary", summaryMetadata.Summary);
12091209
}

0 commit comments

Comments
 (0)