@@ -17,7 +17,7 @@ public static class OpenApiRouteHandlerBuilderExtensions
17
17
private static readonly ExcludeFromDescriptionAttribute _excludeFromDescriptionMetadataAttribute = new ( ) ;
18
18
19
19
/// <summary>
20
- /// Adds the <see cref="IExcludeFromDescriptionMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
20
+ /// Adds the <see cref="IExcludeFromDescriptionMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
21
21
/// produced by <paramref name="builder"/>.
22
22
/// </summary>
23
23
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
@@ -30,7 +30,7 @@ public static RouteHandlerBuilder ExcludeFromDescription(this RouteHandlerBuilde
30
30
}
31
31
32
32
/// <summary>
33
- /// Adds an <see cref="IProducesResponseTypeMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
33
+ /// Adds an <see cref="IProducesResponseTypeMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
34
34
/// produced by <paramref name="builder"/>.
35
35
/// </summary>
36
36
/// <typeparam name="TResponse">The type of the response.</typeparam>
@@ -50,7 +50,7 @@ public static RouteHandlerBuilder Produces<TResponse>(this RouteHandlerBuilder b
50
50
}
51
51
52
52
/// <summary>
53
- /// Adds an <see cref="IProducesResponseTypeMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
53
+ /// Adds an <see cref="IProducesResponseTypeMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
54
54
/// produced by <paramref name="builder"/>.
55
55
/// </summary>
56
56
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
@@ -85,7 +85,7 @@ public static RouteHandlerBuilder Produces(this RouteHandlerBuilder builder,
85
85
86
86
/// <summary>
87
87
/// Adds an <see cref="IProducesResponseTypeMetadata"/> with a <see cref="ProblemDetails"/> type
88
- /// to <see cref="EndpointBuilder.Metadata"/> for all builders produced by <paramref name="builder"/>.
88
+ /// to <see cref="EndpointBuilder.Metadata"/> for all endpoints produced by <paramref name="builder"/>.
89
89
/// </summary>
90
90
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
91
91
/// <param name="statusCode">The response status code.</param>
@@ -105,7 +105,7 @@ public static RouteHandlerBuilder ProducesProblem(this RouteHandlerBuilder build
105
105
106
106
/// <summary>
107
107
/// Adds an <see cref="IProducesResponseTypeMetadata"/> with a <see cref="HttpValidationProblemDetails"/> type
108
- /// to <see cref="EndpointBuilder.Metadata"/> for all builders produced by <paramref name="builder"/>.
108
+ /// to <see cref="EndpointBuilder.Metadata"/> for all endpoints produced by <paramref name="builder"/>.
109
109
/// </summary>
110
110
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
111
111
/// <param name="statusCode">The response status code. Defaults to <see cref="StatusCodes.Status400BadRequest"/>.</param>
@@ -124,7 +124,7 @@ public static RouteHandlerBuilder ProducesValidationProblem(this RouteHandlerBui
124
124
}
125
125
126
126
/// <summary>
127
- /// Adds the <see cref="ITagsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
127
+ /// Adds the <see cref="ITagsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
128
128
/// produced by <paramref name="builder"/>.
129
129
/// </summary>
130
130
/// <remarks>
@@ -142,7 +142,7 @@ public static RouteHandlerBuilder WithTags(this RouteHandlerBuilder builder, par
142
142
}
143
143
144
144
/// <summary>
145
- /// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
145
+ /// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
146
146
/// produced by <paramref name="builder"/>.
147
147
/// </summary>
148
148
/// <typeparam name="TRequest">The type of the request body.</typeparam>
@@ -159,7 +159,7 @@ public static RouteHandlerBuilder Accepts<TRequest>(this RouteHandlerBuilder bui
159
159
}
160
160
161
161
/// <summary>
162
- /// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
162
+ /// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
163
163
/// produced by <paramref name="builder"/>.
164
164
/// </summary>
165
165
/// <typeparam name="TRequest">The type of the request body.</typeparam>
@@ -177,7 +177,7 @@ public static RouteHandlerBuilder Accepts<TRequest>(this RouteHandlerBuilder bui
177
177
}
178
178
179
179
/// <summary>
180
- /// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
180
+ /// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
181
181
/// produced by <paramref name="builder"/>.
182
182
/// </summary>
183
183
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
@@ -193,7 +193,7 @@ public static RouteHandlerBuilder Accepts(this RouteHandlerBuilder builder,
193
193
}
194
194
195
195
/// <summary>
196
- /// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all builders
196
+ /// Adds <see cref="IAcceptsMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
197
197
/// produced by <paramref name="builder"/>.
198
198
/// </summary>
199
199
/// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
@@ -209,6 +209,32 @@ public static RouteHandlerBuilder Accepts(this RouteHandlerBuilder builder,
209
209
return builder ;
210
210
}
211
211
212
+ /// <summary>
213
+ /// Adds <see cref="IEndpointDescriptionMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
214
+ /// produced by <paramref name="builder"/>.
215
+ /// </summary>
216
+ /// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
217
+ /// <param name="description">A string representing a detailed description of the endpoint.</param>
218
+ /// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the endpoint.</returns>
219
+ public static RouteHandlerBuilder WithDescription ( this RouteHandlerBuilder builder , string description )
220
+ {
221
+ builder . WithMetadata ( new EndpointDescriptionAttribute ( description ) ) ;
222
+ return builder ;
223
+ }
224
+
225
+ /// <summary>
226
+ /// Adds <see cref="IEndpointSummaryMetadata"/> to <see cref="EndpointBuilder.Metadata"/> for all endpoints
227
+ /// produced by <paramref name="builder"/>.
228
+ /// </summary>
229
+ /// <param name="builder">The <see cref="RouteHandlerBuilder"/>.</param>
230
+ /// <param name="summary">A string representing a brief description of the endpoint.</param>
231
+ /// <returns>A <see cref="RouteHandlerBuilder"/> that can be used to further customize the endpoint.</returns>
232
+ public static RouteHandlerBuilder WithSummary ( this RouteHandlerBuilder builder , string summary )
233
+ {
234
+ builder . WithMetadata ( new EndpointSummaryAttribute ( summary ) ) ;
235
+ return builder ;
236
+ }
237
+
212
238
private static string [ ] GetAllContentTypes ( string contentType , string [ ] additionalContentTypes )
213
239
{
214
240
var allContentTypes = new string [ additionalContentTypes . Length + 1 ] ;
0 commit comments