mirror of
https://github.com/bitwarden/server.git
synced 2025-12-11 04:34:37 -06:00
Enable custom IDs for bindings (#6340)
* Enable custom IDs for bindings * Remove description
This commit is contained in:
parent
780400fcf9
commit
866a572d26
@ -199,7 +199,7 @@ public class CollectionsController : Controller
|
|||||||
|
|
||||||
[HttpPost("{id}")]
|
[HttpPost("{id}")]
|
||||||
[Obsolete("This endpoint is deprecated. Use PUT /{id} instead.")]
|
[Obsolete("This endpoint is deprecated. Use PUT /{id} instead.")]
|
||||||
public async Task<CollectionResponseModel> Post(Guid orgId, Guid id, [FromBody] UpdateCollectionRequestModel model)
|
public async Task<CollectionResponseModel> PostPut(Guid orgId, Guid id, [FromBody] UpdateCollectionRequestModel model)
|
||||||
{
|
{
|
||||||
return await Put(orgId, id, model);
|
return await Put(orgId, id, model);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,7 +115,7 @@ public class DevicesController : Controller
|
|||||||
|
|
||||||
[HttpPost("{id}")]
|
[HttpPost("{id}")]
|
||||||
[Obsolete("This endpoint is deprecated. Use PUT /{id} instead.")]
|
[Obsolete("This endpoint is deprecated. Use PUT /{id} instead.")]
|
||||||
public async Task<DeviceResponseModel> Post(string id, [FromBody] DeviceRequestModel model)
|
public async Task<DeviceResponseModel> PostPut(string id, [FromBody] DeviceRequestModel model)
|
||||||
{
|
{
|
||||||
return await Put(id, model);
|
return await Put(id, model);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,10 +23,6 @@ public class SourceFileLineOperationFilter : IOperationFilter
|
|||||||
var (fileName, lineNumber) = GetSourceFileLine(context.MethodInfo);
|
var (fileName, lineNumber) = GetSourceFileLine(context.MethodInfo);
|
||||||
if (fileName != null && lineNumber > 0)
|
if (fileName != null && lineNumber > 0)
|
||||||
{
|
{
|
||||||
// Add the information with a link to the source file at the end of the operation description
|
|
||||||
operation.Description +=
|
|
||||||
$"\nThis operation is defined on: [`https://github.com/bitwarden/server/blob/main/{fileName}#L{lineNumber}`]";
|
|
||||||
|
|
||||||
// Also add the information as extensions, so other tools can use it in the future
|
// Also add the information as extensions, so other tools can use it in the future
|
||||||
operation.Extensions.Add("x-source-file", new OpenApiString(fileName));
|
operation.Extensions.Add("x-source-file", new OpenApiString(fileName));
|
||||||
operation.Extensions.Add("x-source-line", new OpenApiInteger(lineNumber));
|
operation.Extensions.Add("x-source-line", new OpenApiInteger(lineNumber));
|
||||||
|
|||||||
@ -19,9 +19,10 @@ public static class SwaggerGenOptionsExt
|
|||||||
// Set the operation ID to the name of the controller followed by the name of the function.
|
// Set the operation ID to the name of the controller followed by the name of the function.
|
||||||
// Note that the "Controller" suffix for the controllers, and the "Async" suffix for the actions
|
// Note that the "Controller" suffix for the controllers, and the "Async" suffix for the actions
|
||||||
// are removed already, so we don't need to do that ourselves.
|
// are removed already, so we don't need to do that ourselves.
|
||||||
// TODO(Dani): This is disabled until we remove all the duplicate operation IDs.
|
config.CustomOperationIds(e => $"{e.ActionDescriptor.RouteValues["controller"]}_{e.ActionDescriptor.RouteValues["action"]}");
|
||||||
// config.CustomOperationIds(e => $"{e.ActionDescriptor.RouteValues["controller"]}_{e.ActionDescriptor.RouteValues["action"]}");
|
// Because we're setting custom operation IDs, we need to ensure that we don't accidentally
|
||||||
// config.DocumentFilter<CheckDuplicateOperationIdsDocumentFilter>();
|
// introduce duplicate IDs, which is against the OpenAPI specification and could lead to issues.
|
||||||
|
config.DocumentFilter<CheckDuplicateOperationIdsDocumentFilter>();
|
||||||
|
|
||||||
// These two filters require debug symbols/git, so only add them in development mode
|
// These two filters require debug symbols/git, so only add them in development mode
|
||||||
if (environment.IsDevelopment())
|
if (environment.IsDevelopment())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user