Skip to content

Commit 4388d27

Browse files
committed
refactor: Standardize and simplify API endpoint summaries, rename book listing to GetBooks, and condense OpenAPI header descriptions.
1 parent 69e4371 commit 4388d27

12 files changed

Lines changed: 38 additions & 61 deletions

File tree

src/ApiService/BookStore.ApiService/Endpoints/Admin/AdminAuthorEndpoints.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ public static RouteGroupBuilder MapAdminAuthorEndpoints(this RouteGroupBuilder g
1414
{
1515
group.MapPost("/", CreateAuthor)
1616
.WithName("CreateAuthor")
17-
.WithSummary("Create a new author using Wolverine command/handler pattern");
17+
.WithSummary("Create a new author");
1818

1919
group.MapPut("/{id:guid}", UpdateAuthor)
2020
.WithName("UpdateAuthor")
2121
.WithSummary("Update an author");
2222

2323
group.MapDelete("/{id:guid}", SoftDeleteAuthor)
2424
.WithName("SoftDeleteAuthor")
25-
.WithSummary("Soft delete an author");
25+
.WithSummary("Delete an author");
2626

2727
group.MapPost("/{id:guid}/restore", RestoreAuthor)
2828
.WithName("RestoreAuthor")
29-
.WithSummary("Restore a soft deleted author");
29+
.WithSummary("Restore a deleted author");
3030

3131
return group;
3232
}

src/ApiService/BookStore.ApiService/Endpoints/Admin/AdminBookEndpoints.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,23 @@ public static RouteGroupBuilder MapAdminBookEndpoints(this RouteGroupBuilder gro
2929
{
3030
group.MapPost("/", CreateBook)
3131
.WithName("CreateBook")
32-
.WithSummary("Create a new book using Wolverine command/handler pattern");
32+
.WithSummary("Create a new book");
3333

3434
group.MapPut("/{id:guid}", UpdateBook)
3535
.WithName("UpdateBook")
36-
.WithSummary("Update a book. Supports optimistic concurrency with If-Match header.");
36+
.WithSummary("Update a book");
3737

3838
group.MapDelete("/{id:guid}", SoftDeleteBook)
3939
.WithName("SoftDeleteBook")
40-
.WithSummary("Soft delete a book. Supports optimistic concurrency with If-Match header.");
40+
.WithSummary("Delete a book");
4141

4242
group.MapPost("/{id:guid}/restore", RestoreBook)
4343
.WithName("RestoreBook")
44-
.WithSummary("Restore a soft deleted book. Supports optimistic concurrency with If-Match header.");
44+
.WithSummary("Restore a deleted book");
4545

4646
group.MapGet("/", GetAllBooks)
4747
.WithName("GetAllBooksAdmin")
48-
.WithSummary("Get all books including soft deleted");
48+
.WithSummary("Get all books");
4949

5050
return group;
5151
}

src/ApiService/BookStore.ApiService/Endpoints/Admin/AdminCategoryEndpoints.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ public static RouteGroupBuilder MapAdminCategoryEndpoints(this RouteGroupBuilder
2121
{
2222
group.MapPost("/", CreateCategory)
2323
.WithName("CreateCategory")
24-
.WithSummary("Create a new category with optional translations using Wolverine");
24+
.WithSummary("Create a new category");
2525

2626
group.MapPut("/{id:guid}", UpdateCategory)
2727
.WithName("UpdateCategory")
28-
.WithSummary("Update a category and its translations");
28+
.WithSummary("Update a category");
2929

3030
group.MapDelete("/{id:guid}", SoftDeleteCategory)
3131
.WithName("SoftDeleteCategory")
32-
.WithSummary("Soft delete a category");
32+
.WithSummary("Delete a category");
3333

3434
group.MapPost("/{id:guid}/restore", RestoreCategory)
3535
.WithName("RestoreCategory")
36-
.WithSummary("Restore a soft deleted category");
36+
.WithSummary("Restore a deleted category");
3737

3838
return group;
3939
}

src/ApiService/BookStore.ApiService/Endpoints/Admin/AdminPublisherEndpoints.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ public static RouteGroupBuilder MapAdminPublisherEndpoints(this RouteGroupBuilde
1414
{
1515
group.MapPost("/", CreatePublisher)
1616
.WithName("CreatePublisher")
17-
.WithSummary("Create a new publisher using Wolverine command/handler pattern");
17+
.WithSummary("Create a new publisher");
1818

1919
group.MapPut("/{id:guid}", UpdatePublisher)
2020
.WithName("UpdatePublisher")
2121
.WithSummary("Update a publisher");
2222

2323
group.MapDelete("/{id:guid}", SoftDeletePublisher)
2424
.WithName("SoftDeletePublisher")
25-
.WithSummary("Soft delete a publisher");
25+
.WithSummary("Delete a publisher");
2626

2727
group.MapPost("/{id:guid}/restore", RestorePublisher)
2828
.WithName("RestorePublisher")
29-
.WithSummary("Restore a soft deleted publisher");
29+
.WithSummary("Restore a deleted publisher");
3030

3131
return group;
3232
}

src/ApiService/BookStore.ApiService/Endpoints/Admin/ProjectionEndpoints.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ public static RouteGroupBuilder MapProjectionEndpoints(this RouteGroupBuilder gr
1010
{
1111
group.MapPost("/rebuild", RebuildProjections)
1212
.WithName("RebuildProjections")
13-
.WithSummary("Rebuild all async projections from event store");
13+
.WithSummary("Rebuild all projections");
1414

1515
group.MapGet("/status", GetProjectionStatus)
1616
.WithName("GetProjectionStatus")
17-
.WithSummary("Get async daemon projection status");
17+
.WithSummary("Get projection status");
1818

1919
return group;
2020
}

src/ApiService/BookStore.ApiService/Endpoints/AuthorEndpoints.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static RouteGroupBuilder MapAuthorEndpoints(this RouteGroupBuilder group)
1616
{
1717
group.MapGet("/", GetAuthors)
1818
.WithName("GetAuthors")
19-
.WithSummary("Get all active authors")
19+
.WithSummary("Get all authors")
2020
.CacheOutput(policy => policy.Expire(TimeSpan.FromMinutes(5)));
2121

2222
group.MapGet("/{id:guid}", GetAuthor)

src/ApiService/BookStore.ApiService/Endpoints/BookEndpoints.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ public static class BookEndpoints
1515
{
1616
public static RouteGroupBuilder MapBookEndpoints(this RouteGroupBuilder group)
1717
{
18-
group.MapGet("/search", SearchBooks)
19-
.WithName("SearchBooks")
20-
.WithSummary("Search books using ngram matching across title, description, publisher, and authors")
18+
group.MapGet("/", SearchBooks)
19+
.WithName("GetBooks")
20+
.WithSummary("Get all books")
2121
.CacheOutput(policy => policy.Expire(TimeSpan.FromMinutes(2)));
2222

2323
group.MapGet("/{id:guid}", GetBook)
2424
.WithName("GetBook")
25-
.WithSummary("Get book by ID. Returns ETag header and supports If-None-Match for caching.")
25+
.WithSummary("Get book by ID")
2626
.CacheOutput(policy => policy
2727
.Expire(TimeSpan.FromMinutes(5))
2828
.SetVaryByHeader("If-None-Match"));

src/ApiService/BookStore.ApiService/Endpoints/CategoryEndpoints.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ public static RouteGroupBuilder MapCategoryEndpoints(this RouteGroupBuilder grou
1919
{
2020
group.MapGet("/", GetCategories)
2121
.WithName("GetCategories")
22-
.WithSummary("Get all active categories (localized based on Accept-Language header)")
22+
.WithSummary("Get all categories")
2323
.CacheOutput(policy => policy.Expire(TimeSpan.FromMinutes(5)));
2424

2525
group.MapGet("/{id:guid}", GetCategory)
2626
.WithName("GetCategory")
27-
.WithSummary("Get category by ID (localized based on Accept-Language header)")
27+
.WithSummary("Get category by ID")
2828
.CacheOutput(policy => policy.Expire(TimeSpan.FromMinutes(5)));
2929

3030
return group;

src/ApiService/BookStore.ApiService/Endpoints/PublisherEndpoints.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static RouteGroupBuilder MapPublisherEndpoints(this RouteGroupBuilder gro
1616
{
1717
group.MapGet("/", GetPublishers)
1818
.WithName("GetPublishers")
19-
.WithSummary("Get all active publishers")
19+
.WithSummary("Get all publishers")
2020
.CacheOutput(policy => policy.Expire(TimeSpan.FromMinutes(5)));
2121

2222
group.MapGet("/{id:guid}", GetPublisher)

src/ApiService/BookStore.ApiService/Infrastructure/OpenApiTransformerExtensions.cs

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static OpenApiOptions AddBookStoreApiDocumentation(this OpenApiOptions op
4242
Name = "api-version",
4343
In = ParameterLocation.Header,
4444
Required = false,
45-
Description = "API version to use. Defaults to 1.0 if not specified. Example: `1.0`"
45+
Description = "API version. Example: `1.0`"
4646
});
4747

4848
// Add localization header
@@ -51,7 +51,7 @@ public static OpenApiOptions AddBookStoreApiDocumentation(this OpenApiOptions op
5151
Name = "Accept-Language",
5252
In = ParameterLocation.Header,
5353
Required = false,
54-
Description = "Preferred language for response content and error messages. Supported values: `en` (English, default), `pt` (Portuguese), `es` (Spanish), `fr` (French), `de` (German)"
54+
Description = "Preferred language. Supported: `en`, `pt`, `es`, `fr`, `de`"
5555
});
5656

5757
// Add correlation ID header
@@ -60,7 +60,7 @@ public static OpenApiOptions AddBookStoreApiDocumentation(this OpenApiOptions op
6060
Name = "X-Correlation-ID",
6161
In = ParameterLocation.Header,
6262
Required = false,
63-
Description = "Correlation ID for distributed tracing. Tracks the entire business transaction across services. If not provided, one will be generated and returned in the response. Example: `01234567-89ab-cdef-0123-456789abcdef`"
63+
Description = "Correlation ID for tracking requests across the system"
6464
});
6565

6666
// Add causation ID header
@@ -69,7 +69,7 @@ public static OpenApiOptions AddBookStoreApiDocumentation(this OpenApiOptions op
6969
Name = "X-Causation-ID",
7070
In = ParameterLocation.Header,
7171
Required = false,
72-
Description = "Causation ID for distributed tracing. Tracks the immediate cause of this request (e.g., ID of the previous event or command). Use the `X-Event-ID` from a previous response. Example: `01234567-89ab-cdef-0123-456789abcdef`"
72+
Description = "Causation ID linking this request to its trigger"
7373
});
7474

7575
return Task.CompletedTask;
@@ -81,35 +81,12 @@ public static OpenApiOptions AddBookStoreApiDocumentation(this OpenApiOptions op
8181
static string BuildApiDescription()
8282
{
8383
return """
84-
Event-sourced book store management system with book search, author, category, and publisher management.
84+
Book store management system with search, authors, categories, and publishers.
8585
86-
## API Versioning
87-
This API uses header-based versioning. Include the `api-version` header in your requests:
88-
- **Current Version**: 1.0
89-
- **Default Behavior**: If no version is specified, v1.0 is assumed
90-
- **Version Header**: `api-version: 1.0`
91-
92-
## Localization
93-
The API supports multiple languages for content and error messages:
94-
- **Supported Languages**: English (en), Portuguese (pt), Spanish (es), French (fr), German (de)
95-
- **Default Language**: English (en)
96-
- **Language Header**: `Accept-Language: pt` (use ISO 639-1 language codes)
97-
98-
## Distributed Tracing
99-
The API implements correlation and causation tracking for distributed tracing:
100-
101-
### Request Headers
102-
- **X-Correlation-ID**: Tracks the entire business transaction across services. If not provided, one will be generated.
103-
- **X-Causation-ID**: Tracks the immediate cause of this request (e.g., the ID of the command or event that triggered this call).
104-
105-
### Response Headers
106-
- **X-Correlation-ID**: Returns the correlation ID used for this request (either provided or generated).
107-
- **X-Event-ID**: Returns the unique ID of any event created by this request (for POST, PUT, DELETE operations).
108-
109-
### Best Practices
110-
- Always include `X-Correlation-ID` when making related API calls to track the full transaction flow
111-
- Use the previous response's `X-Event-ID` as the `X-Causation-ID` for subsequent related requests
112-
- Store correlation IDs in your logs to enable end-to-end tracing
86+
## Features
87+
- Multi-language support (English, Portuguese, Spanish, French, German)
88+
- Request tracking with correlation IDs
89+
- Optimistic concurrency control for updates
11390
""";
11491
}
11592
}

0 commit comments

Comments
 (0)