Skip to content

Commit a3e4171

Browse files
authored
Address non-test related feedback
1 parent 504b9f1 commit a3e4171

File tree

5 files changed

+43
-36
lines changed

5 files changed

+43
-36
lines changed

src/Http/Routing/src/Builder/RoutingEndpointConventionBuilderExtensions.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ public static TBuilder WithMetadata<TBuilder>(this TBuilder builder, params obje
121121

122122
/// <summary>
123123
/// Sets the <see cref="EndpointNameAttribute"/> for all endpoints produced
124-
/// on the target <see cref="IEndpointConventionBuilder"/>.
124+
/// on the target <see cref="IEndpointConventionBuilder"/> given the <paramref name="endpointName" />.
125+
/// The <see cref="IEndpointNameMetadata" /> on the endpoint is used for link generation and
126+
/// is treated as the operation ID in the given endpoint's OpenAPI specification.
125127
/// </summary>
126128
/// <param name="builder">The <see cref="IEndpointConventionBuilder"/>.</param>
127129
/// <param name="endpointName">The endpoint name.</param>
@@ -134,7 +136,9 @@ public static TBuilder WithName<TBuilder>(this TBuilder builder, string endpoint
134136

135137
/// <summary>
136138
/// Sets the <see cref="EndpointGroupNameAttribute"/> for all endpoints produced
137-
/// on the target <see cref="IEndpointConventionBuilder"/>.
139+
/// on the target <see cref="IEndpointConventionBuilder"/> given the <paramref name="endpointGroupName" />.
140+
/// The <see cref="IEndpointGroupNameMetadata" /> on the endpoint is used to set the endpoint's
141+
/// GroupName in the OpenAPI specification.
138142
/// </summary>
139143
/// <param name="builder">The <see cref="IEndpointConventionBuilder"/>.</param>
140144
/// <param name="endpointGroupName">The endpoint group name.</param>

src/Http/Routing/src/EndpointGroupNameAttribute.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
using System;
55
using Microsoft.AspNetCore.Http;
6-
6+
77
namespace Microsoft.AspNetCore.Routing
88
{
99
/// <summary>
@@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Routing
1313
public sealed class EndpointGroupNameAttribute : Attribute, IEndpointGroupNameMetadata
1414
{
1515
/// <summary>
16-
/// Initializes an instance of the EndpointGroupNameAttribute.
16+
/// Initializes an instance of the <see cref="EndpointGroupNameAttribute"/>.
1717
/// </summary>
1818
/// <param name="endpointGroupName">The endpoint group name.</param>
1919
public EndpointGroupNameAttribute(string endpointGroupName)
@@ -22,7 +22,7 @@ public EndpointGroupNameAttribute(string endpointGroupName)
2222
{
2323
throw new ArgumentNullException(nameof(endpointGroupName));
2424
}
25-
25+
2626
EndpointGroupName = endpointGroupName;
2727
}
2828

src/Mvc/Mvc.ApiExplorer/src/EndpointMetadataApiDescriptionProvider.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ public void OnProvidersExecuting(ApiDescriptionProviderContext context)
5353
if (endpoint is RouteEndpoint routeEndpoint &&
5454
routeEndpoint.Metadata.GetMetadata<MethodInfo>() is { } methodInfo &&
5555
routeEndpoint.Metadata.GetMetadata<IHttpMethodMetadata>() is { } httpMethodMetadata &&
56-
(routeEndpoint.Metadata.GetMetadata<IExcludeFromDescriptionMetadata>() == null ||
57-
routeEndpoint.Metadata.GetMetadata<IExcludeFromDescriptionMetadata>() is { ExcludeFromDescription: false} ))
56+
routeEndpoint.Metadata.GetMetadata<IExcludeFromDescriptionMetadata>() is null or { ExcludeFromDescription: false})
5857
{
5958
// REVIEW: Should we add an ApiDescription for endpoints without IHttpMethodMetadata? Swagger doesn't handle
6059
// a null HttpMethod even though it's nullable on ApiDescription, so we'd need to define "default" HTTP methods.

src/Mvc/Mvc.Core/src/ProducesResponseTypeAttribute.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.AspNetCore.Mvc.ApiExplorer;
66
using Microsoft.AspNetCore.Mvc.Formatters;
77
using Microsoft.Net.Http.Headers;
8+
using Resources = Microsoft.AspNetCore.Mvc.Core.Resources;
89

910
namespace Microsoft.AspNetCore.Mvc
1011
{
@@ -102,7 +103,7 @@ void IApiResponseMetadataProvider.SetContentTypes(MediaTypeCollection contentTyp
102103

103104
private static MediaTypeCollection GetContentTypes(string contentType, string[] additionalContentTypes)
104105
{
105-
List<string> completeContentTypes = new(additionalContentTypes.Length + 1);
106+
var completeContentTypes = new List<string>(additionalContentTypes.Length + 1);
106107
completeContentTypes.Add(contentType);
107108
completeContentTypes.AddRange(additionalContentTypes);
108109
MediaTypeCollection contentTypes = new();
@@ -111,7 +112,7 @@ private static MediaTypeCollection GetContentTypes(string contentType, string[]
111112
var mediaType = new MediaType(type);
112113
if (mediaType.HasWildcard)
113114
{
114-
throw new InvalidOperationException("Content types with wildcards are not supported.");
115+
throw new InvalidOperationException(Resources.FormatGetContentTypes_WildcardsNotSupported(type));
115116
}
116117

117118
contentTypes.Add(type);

src/Mvc/Mvc.Core/src/Resources.resx

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<root>
3-
<!--
4-
Microsoft ResX Schema
5-
3+
<!--
4+
Microsoft ResX Schema
5+
66
Version 2.0
7-
8-
The primary goals of this format is to allow a simple XML format
9-
that is mostly human readable. The generation and parsing of the
10-
various data types are done through the TypeConverter classes
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
1111
associated with the data types.
12-
12+
1313
Example:
14-
14+
1515
... ado.net/XML headers & schema ...
1616
<resheader name="resmimetype">text/microsoft-resx</resheader>
1717
<resheader name="version">2.0</resheader>
@@ -26,36 +26,36 @@
2626
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
2727
<comment>This is a comment</comment>
2828
</data>
29-
30-
There are any number of "resheader" rows that contain simple
29+
30+
There are any number of "resheader" rows that contain simple
3131
name/value pairs.
32-
33-
Each data row contains a name, and value. The row also contains a
34-
type or mimetype. Type corresponds to a .NET class that support
35-
text/value conversion through the TypeConverter architecture.
36-
Classes that don't support this are serialized and stored with the
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
3737
mimetype set.
38-
39-
The mimetype is used for serialized objects, and tells the
40-
ResXResourceReader how to depersist the object. This is currently not
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
4141
extensible. For a given mimetype the value must be set accordingly:
42-
43-
Note - application/x-microsoft.net.object.binary.base64 is the format
44-
that the ResXResourceWriter will generate, however the reader can
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
4545
read any of the formats listed below.
46-
46+
4747
mimetype: application/x-microsoft.net.object.binary.base64
48-
value : The object must be serialized with
48+
value : The object must be serialized with
4949
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
5050
: and then encoded with base64 encoding.
51-
51+
5252
mimetype: application/x-microsoft.net.object.soap.base64
53-
value : The object must be serialized with
53+
value : The object must be serialized with
5454
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
5555
: and then encoded with base64 encoding.
5656
5757
mimetype: application/x-microsoft.net.object.bytearray.base64
58-
value : The object must be serialized into a byte array
58+
value : The object must be serialized into a byte array
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
@@ -510,4 +510,7 @@
510510
<data name="TryUpdateModel_RecordTypeNotSupported" xml:space="preserve">
511511
<value>{0} cannot update a record type model. If a '{1}' must be updated, include it in an object type.</value>
512512
</data>
513+
<data name="GetContentTypes_WildcardsNotSupported" xml:space="preserve">
514+
<value>Could not parse '{0}'. Content types with wildcards are not supported.</value>
515+
</data>
513516
</root>

0 commit comments

Comments
 (0)