Skip to content

Commit fb3fb21

Browse files
authored
Attribute names (#3)
* - simplify route group member attribute name * - add MapMethods configuration method to EndpointConfigurator * - add parentRouteGroup parameter to IUriResolverProvider.GetResolver method * - bump version
1 parent 44bdc61 commit fb3fb21

30 files changed

+81
-53
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
<PackageReadmeFile>README.md</PackageReadmeFile>
1818
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1919

20-
<Version>0.3.3</Version>
20+
<Version>0.4.0</Version>
2121
</PropertyGroup>
2222
</Project>

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ By default, all endpoints are mapped under root route group. It is possible to d
215215

216216
- [Create a route group implementation](./samples/ShowcaseWebApi/Features/FeaturesRouteGroup.cs) by inheriting RouteGroupConfigurator and implementing 'Configure' method,
217217
- Configuration of each route group implementation starts with calling MapGroup method with a route pattern prefix. The return of 'MapGroup' method, a RouteGroupBuilder instance, can be used to further customize the route group like a regular Minimal Api route group.
218-
- Apply RouteGroupMember attribute to either other [route group](./samples/ShowcaseWebApi/Features/Books/Configuration/BooksV1RouteGroup.cs) or [endpoint](./samples/ShowcaseWebApi/Features/Books/CreateBook.cs) classes that will be mapped under created route group. Use type of the new route group implementation as ParentGroupType property of attribute.
218+
- Apply MapToGroup attribute to either other [route group](./samples/ShowcaseWebApi/Features/Books/Configuration/BooksV1RouteGroup.cs) or [endpoint](./samples/ShowcaseWebApi/Features/Books/CreateBook.cs) classes that will be mapped under created route group. Use type of the new route group implementation as GroupType parameter to the attribute.
219219

220220
Following sample creates a parent route group (FeaturesRouteGroup), a child route group (BooksV1RouteGroup) and maps an endpoint (CreateBook) to child route group. Group configuration methods used for this particular sample are all part of Minimal Apis ecosystem and are under [Asp.Versioning](https://github.com/dotnet/aspnet-api-versioning) .
221221

@@ -236,7 +236,7 @@ internal class FeaturesRouteGroup : RouteGroupConfigurator
236236
}
237237
}
238238

239-
[RouteGroupMember(typeof(FeaturesRouteGroup))]
239+
[MapToGroup(typeof(FeaturesRouteGroup))]
240240
internal class BooksV1RouteGroup : RouteGroupConfigurator
241241
{
242242
protected override void Configure(
@@ -249,7 +249,7 @@ internal class BooksV1RouteGroup : RouteGroupConfigurator
249249
}
250250
}
251251

252-
[RouteGroupMember(typeof(BooksV1RouteGroup))]
252+
[MapToGroup(typeof(BooksV1RouteGroup))]
253253
internal class CreateBook(ServiceDbContext db, ILocationStore location)
254254
: WebResultEndpoint<CreateBookRequest, CreateBookResponse>
255255
{

samples/ShowcaseWebApi/Features/Books/Configuration/BooksV1RouteGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace ShowcaseWebApi.Features.Books.Configuration;
44

5-
[RouteGroupMember(typeof(FeaturesRouteGroup))]
5+
[MapToGroup(typeof(FeaturesRouteGroup))]
66
internal class BooksV1RouteGroup : RouteGroupConfigurator
77
{
88
protected override void Configure(

samples/ShowcaseWebApi/Features/Books/Configuration/BooksV2RouteGroup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace ShowcaseWebApi.Features.Books.Configuration;
44

5-
[RouteGroupMember(typeof(FeaturesRouteGroup))]
5+
[MapToGroup(typeof(FeaturesRouteGroup))]
66
internal class BooksV2RouteGroup : RouteGroupConfigurator
77
{
88
protected override void Configure(

samples/ShowcaseWebApi/Features/Books/CreateBook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public CreateBookRequestValidator()
2424
}
2525
}
2626

27-
[RouteGroupMember(typeof(BooksV1RouteGroup))]
27+
[MapToGroup(typeof(BooksV1RouteGroup))]
2828
internal class CreateBook(ServiceDbContext db, ILocationStore location)
2929
: WebResultEndpoint<CreateBookRequest, CreateBookResponse>
3030
{

samples/ShowcaseWebApi/Features/Books/DeleteBook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public DeleteBookRequestValidator()
1717
}
1818
}
1919

20-
[RouteGroupMember(typeof(BooksV1RouteGroup))]
20+
[MapToGroup(typeof(BooksV1RouteGroup))]
2121
internal class DeleteBook(ServiceDbContext db)
2222
: WebResultEndpoint<DeleteBookRequest>
2323
{

samples/ShowcaseWebApi/Features/Books/GetBookById.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public GetBookByIdRequestValidator()
2020
}
2121
}
2222

23-
[RouteGroupMember(typeof(BooksV1RouteGroup))]
23+
[MapToGroup(typeof(BooksV1RouteGroup))]
2424
internal class GetBookById(ServiceDbContext db)
2525
: WebResultEndpoint<GetBookByIdRequest, GetBookByIdResponse>
2626
{

samples/ShowcaseWebApi/Features/Books/ListBooks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace ShowcaseWebApi.Features.Books;
1010
public record ListBooksResponse(List<ListBooksResponseItem> Books);
1111
public record ListBooksResponseItem(Guid Id, string Title, string Author, decimal Price);
1212

13-
[RouteGroupMember(typeof(BooksV1RouteGroup))]
13+
[MapToGroup(typeof(BooksV1RouteGroup))]
1414
internal class ListBooks(ServiceDbContext db)
1515
: WebResultEndpointWithEmptyRequest<ListBooksResponse>
1616
{

samples/ShowcaseWebApi/Features/Books/UpdateBook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public UpdateBookRequestValidator()
2525
}
2626
}
2727

28-
[RouteGroupMember(typeof(BooksV1RouteGroup))]
28+
[MapToGroup(typeof(BooksV1RouteGroup))]
2929
internal class UpdateBook(ServiceDbContext db)
3030
: WebResultEndpoint<UpdateBookRequest, UpdateBookResponse>
3131
{

samples/ShowcaseWebApi/Features/Books/UploadBook.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public UploadBookRequestValidator()
2020
}
2121
}
2222

23-
[RouteGroupMember(typeof(BooksV2RouteGroup))]
23+
[MapToGroup(typeof(BooksV2RouteGroup))]
2424
internal class UploadBook
2525
: WebResultEndpoint<UploadBookRequest, UploadBookResponse>
2626
{

0 commit comments

Comments
 (0)