Skip to content

Commit 73e14ed

Browse files
author
vp
committed
Add names to system endpoints (openapi - operationid)
1 parent a5f03be commit 73e14ed

5 files changed

Lines changed: 30 additions & 5 deletions

File tree

src/Presentation.Web/Endpoints/LogEntryEndpoints.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,28 +41,28 @@ public override void Map(IEndpointRouteBuilder app)
4141
.Produces<LogEntryQueryResponse>()
4242
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
4343
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError)
44-
.WithName("GetLogEntries")
44+
.WithName("System.GetLogEntries")
4545
.WithDescription("Retrieves a paged list of log entries with optional filters. Dates must be in ISO 8601 format (e.g., 2025-04-15T00:00:00Z).");
4646

4747
group.MapGet("stream", this.StreamLogEntries)
4848
.Produces<IEnumerable<LogEntryModel>>()
4949
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
5050
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError)
51-
.WithName("StreamLogEntries")
51+
.WithName("System.StreamLogEntries")
5252
.WithDescription("Streams log entries in real-time based on optional filters. Dates must be in ISO 8601 format (e.g., 2025-04-15T00:00:00Z).");
5353

5454
group.MapDelete("", this.CleanupLogEntries)
5555
.Produces<string>((int)HttpStatusCode.Accepted)
5656
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
5757
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError)
58-
.WithName("CleanupLogEntries")
58+
.WithName("System.CleanupLogEntries")
5959
.WithDescription("Queues a maintenance operation for log entries older than a specified date or age, with options to archive, set batch size, and delay interval. Date must be in ISO 8601 format (e.g., 2025-04-01T00:00:00Z).");
6060

6161
group.MapGet("stats", this.GetLogEntriesStatistics)
6262
.Produces<LogEntryStatisticsModel>()
6363
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
6464
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError)
65-
.WithName("GetLogEntriesStatistics")
65+
.WithName("System.GetLogEntriesStatistics")
6666
.WithDescription("Retrieves aggregated statistics for log entries, grouped by time intervals. Dates must be in ISO 8601 format (e.g., 2025-04-15T00:00:00Z).");
6767

6868
group.MapGet("export", this.ExportLogEntries)
@@ -71,7 +71,7 @@ public override void Map(IEndpointRouteBuilder app)
7171
//.Produces("text/plain")
7272
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
7373
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError)
74-
.WithName("ExportLogEntries")
74+
.WithName("System.ExportLogEntries")
7575
.WithDescription("Exports log entries as a downloadable file in the specified format (csv, json, txt). Dates must be in ISO 8601 format (e.g., 2025-04-15T00:00:00Z).");
7676
}
7777

src/Presentation.Web/Endpoints/SystemEndpoints.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,30 @@ public override void Map(IEndpointRouteBuilder app)
3333
var group = this.MapGroup(app, this.options);
3434

3535
group.MapGet(string.Empty, this.GetSystem)
36+
.WithName("System.Get")
3637
.Produces<Dictionary<string, string>>()
3738
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
3839

3940
if (this.options.EchoEnabled)
4041
{
4142
group.MapGet("echo", this.GetEcho)
43+
.WithName("System.GetEcho")
4244
.Produces<string>()
4345
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
4446
}
4547

4648
if (this.options.InfoEnabled)
4749
{
4850
group.MapGet("info", this.GetInfo)
51+
.WithName("System.GetInfo")
4952
.Produces<SystemInfo>()
5053
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
5154
}
5255

5356
if (this.options.ModulesEnabled)
5457
{
5558
group.MapGet("modules", this.GetModules)
59+
.WithName("System.GetModules")
5660
.Produces<IEnumerable<SystemModule>>()
5761
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
5862
}

src/Presentation.Web/Identity/IdentityEntityPermissionEvaluationEndpoints.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ public override void Map(IEndpointRouteBuilder app)
2828
var group = this.MapGroup(app, this.options);
2929

3030
group.MapGet("/{permission}", this.HasRequiredPermission)
31+
.WithName("System.HasRequiredPermission")
3132
.WithDescription("Checks if the current user has the required permission for the entity type.")
3233
.Produces<EntityPermissionModel>()
3334
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
3435

3536
group.MapGet(string.Empty, this.GetEffectivePermissions)
37+
.WithName("System.GetEffectivePermissions")
3638
.WithDescription("Gets all effective permissions for the current user and the entity type.")
3739
.Produces<EntityPermissionModel>()
3840
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);

src/Presentation.Web/Identity/IdentityEntityPermissionManagementEndpoints.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,61 +30,71 @@ public override void Map(IEndpointRouteBuilder app)
3030

3131
// User Permission Management
3232
group.MapPost("/users/{userId}/grant", this.GrantUserPermission)
33+
.WithName("System.GrantUserPermission")
3334
.WithDescription("Grants a specific permission to a user for a specific entity.")
3435
.Produces((int)HttpStatusCode.NoContent)
3536
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
3637
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
3738

3839
group.MapPost("/users/{userId}/revoke", this.RevokeUserPermission)
40+
.WithName("System.RevokeUserPermission")
3941
.WithDescription("Revokes a specific permission from a user for a specific entity.")
4042
.Produces((int)HttpStatusCode.NoContent)
4143
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
4244
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
4345

4446
group.MapPost("/users/{userId}/revoke/all", this.RevokeAllUserPermissions)
47+
.WithName("System.RevokeAllUserPermissions")
4548
.WithDescription("Revokes all permissions from a user.")
4649
.Produces((int)HttpStatusCode.NoContent)
4750
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
4851
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
4952

5053
group.MapGet("/users/{userId}", this.GetUserGrantedPermissions)
54+
.WithName("System.GetUserGrantedPermissions")
5155
.WithDescription("Retrieves all granted permissions for a user for a specific entity.") // does not take the defaults into account
5256
.Produces<IReadOnlyCollection<string>>()
5357
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
5458
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
5559

5660
group.MapGet("/users", this.GetUsersGrantedPermissions)
61+
.WithName("System.GetUsersGrantedPermissions")
5762
.WithDescription("Retrieves all granted permissions for all users for a specific entity.") // does not take the defaults into account
5863
.Produces<IReadOnlyCollection<EntityPermissionInfo>>()
5964
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
6065
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
6166

6267
// Role Permission Management
6368
group.MapPost("/roles/{role}/grant", this.GrantRolePermission)
69+
.WithName("System.GrantRolePermission")
6470
.WithDescription("Grants a specific permission to a role for a specific entity.")
6571
.Produces((int)HttpStatusCode.NoContent)
6672
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
6773
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
6874

6975
group.MapPost("/roles/{role}/revoke", this.RevokeRolePermission)
76+
.WithName("System.RevokeRolePermission")
7077
.WithDescription("Revokes a specific permission from a role for a specific entity.")
7178
.Produces((int)HttpStatusCode.NoContent)
7279
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
7380
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
7481

7582
group.MapPost("/roles/{role}/revoke/all", this.RevokeAllRolePermissions)
83+
.WithName("System.RevokeAllRolePermissions")
7684
.WithDescription("Revokes all permissions from a role.")
7785
.Produces((int)HttpStatusCode.NoContent)
7886
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
7987
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
8088

8189
group.MapGet("/roles/{role}", this.GetRoleGrantedPermissions)
90+
.WithName("System.GetRoleGrantedPermissions")
8291
.WithDescription("Retrieves all granted permissions for a role for a specific entity.") // does not take the defaults into account
8392
.Produces<IReadOnlyCollection<string>>()
8493
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)
8594
.Produces<ProblemDetails>((int)HttpStatusCode.InternalServerError);
8695

8796
group.MapGet("/roles", this.GetRolesGrantedPermissions)
97+
.WithName("System.GetRolesGrantedPermissions")
8898
.WithDescription("Retrieves all granted permissions for all roles for a specific entity.") // does not take the defaults into account
8999
.Produces<IReadOnlyCollection<EntityPermissionInfo>>()
90100
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest)

src/Presentation.Web/IdentityProvider/FakeIdentityProviderEndpoints.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,45 +38,54 @@ public override void Map(IEndpointRouteBuilder app)
3838
var paths = options.EndpointPaths;
3939

4040
group.MapGet("/", this.HandleIndex)
41+
.WithName("System.IdentityProvider.Index")
4142
.WithDescription("Shows the dashboard index page.")
4243
.Produces<string>((int)HttpStatusCode.OK)
4344
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest).ExcludeFromDescription();
4445

4546
group.MapGet(paths.WellKnownConfiguration, this.GetConfiguration)
47+
.WithName("System.IdentityProvider.WellKnownConfiguration")
4648
.WithDescription("Returns the OpenID Connect discovery document.")
4749
.Produces<OpenIdConfiguration>().AllowAnonymous();
4850

4951
app.MapGet(paths.WellKnownConfiguration, this.GetConfiguration)
52+
.WithName("System.IdentityProvider.WellKnownConfiguration.Root")
5053
.WithDescription("Returns the OpenID Connect discovery document (root level).")
5154
.Produces<OpenIdConfiguration>().AllowAnonymous().ExcludeFromDescription();
5255

5356
group.MapGet(paths.Authorize, this.HandleAuthorize)
57+
.WithName("System.IdentityProvider.Authorize")
5458
.WithDescription("Shows the signin page for user selection.")
5559
.Produces<string>((int)HttpStatusCode.OK)
5660
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest);
5761

5862
group.MapGet(paths.AuthorizeCallback, this.HandleAuthorizeCallBack)
63+
.WithName("System.IdentityProvider.AuthorizeCallback")
5964
.WithDescription("Handles the user selection and generates authorization code.")
6065
.Produces((int)HttpStatusCode.Redirect)
6166
.Produces<ProblemDetails>((int)HttpStatusCode.BadRequest);
6267

6368
group.MapPost(paths.Token, this.HandleTokenRequest)
69+
.WithName("System.IdentityProvider.Token")
6470
.WithDescription("Issues tokens for various grant types.")
6571
.Accepts<IFormCollection>("application/x-www-form-urlencoded")
6672
.Produces<TokenResponse>()
6773
.Produces<OAuth2Error>((int)HttpStatusCode.BadRequest);
6874

6975
group.MapGet(paths.UserInfo, this.GetUserInfo)
76+
.WithName("System.IdentityProvider.UserInfo")
7077
.WithDescription("Returns information about the authenticated user.")
7178
.Produces<UserInfoResponse>()
7279
.Produces<ProblemDetails>((int)HttpStatusCode.Unauthorized);
7380

7481
group.MapGet(paths.Logout, this.HandleLogout)
82+
.WithName("System.IdentityProvider.Logout")
7583
.WithDescription("Handles user logout.")
7684
.Produces((int)HttpStatusCode.OK)
7785
.Produces((int)HttpStatusCode.Redirect);
7886

7987
group.MapGet(paths.DebugInfo, this.GetDebugInfo)
88+
.WithName("System.IdentityProvider.DebugInfo")
8089
.WithDescription("Returns debug information about the identity provider configuration.")
8190
.Produces<DebugInfoResponse>();
8291
}

0 commit comments

Comments
 (0)