Skip to content

Commit ec3fe12

Browse files
committed
Improve Swagger OperationIDs for Vault
1 parent 5a74988 commit ec3fe12

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

src/Api/Vault/Controllers/CiphersController.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using Bit.Core.Vault.Queries;
2626
using Bit.Core.Vault.Repositories;
2727
using Bit.Core.Vault.Services;
28+
using Bit.SharedWeb.Swagger;
2829
using Microsoft.AspNetCore.Authorization;
2930
using Microsoft.AspNetCore.Mvc;
3031

@@ -108,8 +109,9 @@ public async Task<CipherMiniResponseModel> GetAdmin(string id)
108109
return new CipherMiniDetailsResponseModel(cipher, _globalSettings, collectionCiphersGroupDict, cipher.OrganizationUseTotp);
109110
}
110111

111-
[HttpGet("{id}/full-details")]
112112
[HttpGet("{id}/details")]
113+
[HttpGet("{id}/full-details")]
114+
[SwaggerExclude("GET", "full-details")]
113115
public async Task<CipherDetailsResponseModel> GetDetails(Guid id)
114116
{
115117
var user = await _userService.GetUserByPrincipalAsync(User);
@@ -125,7 +127,7 @@ public async Task<CipherDetailsResponseModel> GetDetails(Guid id)
125127
}
126128

127129
[HttpGet("")]
128-
public async Task<ListResponseModel<CipherDetailsResponseModel>> Get()
130+
public async Task<ListResponseModel<CipherDetailsResponseModel>> GetAll()
129131
{
130132
var user = await _userService.GetUserByPrincipalAsync(User);
131133
var hasOrgs = _currentContext.Organizations.Count != 0;
@@ -233,6 +235,7 @@ public async Task<CipherMiniResponseModel> PostAdmin([FromBody] CipherCreateRequ
233235

234236
[HttpPut("{id}")]
235237
[HttpPost("{id}")]
238+
[SwaggerExclude("POST")]
236239
public async Task<CipherResponseModel> Put(Guid id, [FromBody] CipherRequestModel model)
237240
{
238241
var user = await _userService.GetUserByPrincipalAsync(User);
@@ -275,6 +278,7 @@ await _applicationCacheService.GetOrganizationAbilitiesAsync(),
275278

276279
[HttpPut("{id}/admin")]
277280
[HttpPost("{id}/admin")]
281+
[SwaggerExclude("POST")]
278282
public async Task<CipherMiniResponseModel> PutAdmin(Guid id, [FromBody] CipherRequestModel model)
279283
{
280284
var userId = _userService.GetProperUserId(User).Value;
@@ -679,6 +683,7 @@ private async Task<bool> CanEditItemsInCollections(Guid organizationId, IEnumera
679683

680684
[HttpPut("{id}/partial")]
681685
[HttpPost("{id}/partial")]
686+
[SwaggerExclude("POST")]
682687
public async Task<CipherResponseModel> PutPartial(Guid id, [FromBody] CipherPartialRequestModel model)
683688
{
684689
var user = await _userService.GetUserByPrincipalAsync(User);
@@ -696,6 +701,7 @@ await _applicationCacheService.GetOrganizationAbilitiesAsync(),
696701

697702
[HttpPut("{id}/share")]
698703
[HttpPost("{id}/share")]
704+
[SwaggerExclude("POST")]
699705
public async Task<CipherResponseModel> PutShare(Guid id, [FromBody] CipherShareRequestModel model)
700706
{
701707
var user = await _userService.GetUserByPrincipalAsync(User);
@@ -733,6 +739,7 @@ await _applicationCacheService.GetOrganizationAbilitiesAsync(),
733739

734740
[HttpPut("{id}/collections")]
735741
[HttpPost("{id}/collections")]
742+
[SwaggerExclude("POST")]
736743
public async Task<CipherDetailsResponseModel> PutCollections(Guid id, [FromBody] CipherCollectionsRequestModel model)
737744
{
738745
var user = await _userService.GetUserByPrincipalAsync(User);
@@ -759,6 +766,7 @@ await _applicationCacheService.GetOrganizationAbilitiesAsync(),
759766

760767
[HttpPut("{id}/collections_v2")]
761768
[HttpPost("{id}/collections_v2")]
769+
[SwaggerExclude("POST")]
762770
public async Task<OptionalCipherDetailsResponseModel> PutCollections_vNext(Guid id, [FromBody] CipherCollectionsRequestModel model)
763771
{
764772
var user = await _userService.GetUserByPrincipalAsync(User);
@@ -793,6 +801,7 @@ await _applicationCacheService.GetOrganizationAbilitiesAsync(),
793801

794802
[HttpPut("{id}/collections-admin")]
795803
[HttpPost("{id}/collections-admin")]
804+
[SwaggerExclude("POST")]
796805
public async Task<CipherMiniDetailsResponseModel> PutCollectionsAdmin(string id, [FromBody] CipherCollectionsRequestModel model)
797806
{
798807
var userId = _userService.GetProperUserId(User).Value;
@@ -842,6 +851,7 @@ public async Task PostBulkCollections([FromBody] CipherBulkUpdateCollectionsRequ
842851

843852
[HttpDelete("{id}")]
844853
[HttpPost("{id}/delete")]
854+
[SwaggerExclude("POST")]
845855
public async Task Delete(Guid id)
846856
{
847857
var userId = _userService.GetProperUserId(User).Value;
@@ -856,6 +866,7 @@ public async Task Delete(Guid id)
856866

857867
[HttpDelete("{id}/admin")]
858868
[HttpPost("{id}/delete-admin")]
869+
[SwaggerExclude("POST")]
859870
public async Task DeleteAdmin(Guid id)
860871
{
861872
var userId = _userService.GetProperUserId(User).Value;
@@ -871,6 +882,7 @@ public async Task DeleteAdmin(Guid id)
871882

872883
[HttpDelete("")]
873884
[HttpPost("delete")]
885+
[SwaggerExclude("POST")]
874886
public async Task DeleteMany([FromBody] CipherBulkDeleteRequestModel model)
875887
{
876888
if (!_globalSettings.SelfHosted && model.Ids.Count() > 500)
@@ -885,6 +897,7 @@ public async Task DeleteMany([FromBody] CipherBulkDeleteRequestModel model)
885897

886898
[HttpDelete("admin")]
887899
[HttpPost("delete-admin")]
900+
[SwaggerExclude("POST")]
888901
public async Task DeleteManyAdmin([FromBody] CipherBulkDeleteRequestModel model)
889902
{
890903
if (!_globalSettings.SelfHosted && model.Ids.Count() > 500)
@@ -1051,6 +1064,7 @@ public async Task<ListResponseModel<CipherMiniResponseModel>> PutRestoreManyAdmi
10511064

10521065
[HttpPut("move")]
10531066
[HttpPost("move")]
1067+
[SwaggerExclude("POST")]
10541068
public async Task MoveMany([FromBody] CipherBulkMoveRequestModel model)
10551069
{
10561070
if (!_globalSettings.SelfHosted && model.Ids.Count() > 500)
@@ -1065,6 +1079,7 @@ public async Task MoveMany([FromBody] CipherBulkMoveRequestModel model)
10651079

10661080
[HttpPut("share")]
10671081
[HttpPost("share")]
1082+
[SwaggerExclude("POST")]
10681083
public async Task<ListResponseModel<CipherMiniResponseModel>> PutShareMany([FromBody] CipherBulkShareRequestModel model)
10691084
{
10701085
var organizationId = new Guid(model.Ciphers.First().OrganizationId);
@@ -1230,7 +1245,7 @@ await Request.GetFileAsync(async (stream) =>
12301245
[Obsolete("Deprecated Attachments API", false)]
12311246
[RequestSizeLimit(Constants.FileSize101mb)]
12321247
[DisableFormValueModelBinding]
1233-
public async Task<CipherResponseModel> PostAttachment(Guid id)
1248+
public async Task<CipherResponseModel> PostAttachmentV1(Guid id)
12341249
{
12351250
ValidateAttachment();
12361251

@@ -1325,6 +1340,7 @@ await _cipherService.CreateAttachmentShareAsync(cipher, stream, fileName, key,
13251340

13261341
[HttpDelete("{id}/attachment/{attachmentId}")]
13271342
[HttpPost("{id}/attachment/{attachmentId}/delete")]
1343+
[SwaggerExclude("POST")]
13281344
public async Task<DeleteAttachmentResponseData> DeleteAttachment(Guid id, string attachmentId)
13291345
{
13301346
var userId = _userService.GetProperUserId(User).Value;
@@ -1339,6 +1355,7 @@ public async Task<DeleteAttachmentResponseData> DeleteAttachment(Guid id, string
13391355

13401356
[HttpDelete("{id}/attachment/{attachmentId}/admin")]
13411357
[HttpPost("{id}/attachment/{attachmentId}/delete-admin")]
1358+
[SwaggerExclude("POST")]
13421359
public async Task<DeleteAttachmentResponseData> DeleteAttachmentAdmin(Guid id, string attachmentId)
13431360
{
13441361
var userId = _userService.GetProperUserId(User).Value;

src/Api/Vault/Controllers/FoldersController.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Bit.Core.Services;
99
using Bit.Core.Vault.Repositories;
1010
using Bit.Core.Vault.Services;
11+
using Bit.SharedWeb.Swagger;
1112
using Microsoft.AspNetCore.Authorization;
1213
using Microsoft.AspNetCore.Mvc;
1314

@@ -45,7 +46,7 @@ public async Task<FolderResponseModel> Get(string id)
4546
}
4647

4748
[HttpGet("")]
48-
public async Task<ListResponseModel<FolderResponseModel>> Get()
49+
public async Task<ListResponseModel<FolderResponseModel>> GetAll()
4950
{
5051
var userId = _userService.GetProperUserId(User).Value;
5152
var folders = await _folderRepository.GetManyByUserIdAsync(userId);
@@ -64,6 +65,7 @@ public async Task<FolderResponseModel> Post([FromBody] FolderRequestModel model)
6465

6566
[HttpPut("{id}")]
6667
[HttpPost("{id}")]
68+
[SwaggerExclude("POST")]
6769
public async Task<FolderResponseModel> Put(string id, [FromBody] FolderRequestModel model)
6870
{
6971
var userId = _userService.GetProperUserId(User).Value;
@@ -79,6 +81,7 @@ public async Task<FolderResponseModel> Put(string id, [FromBody] FolderRequestMo
7981

8082
[HttpDelete("{id}")]
8183
[HttpPost("{id}/delete")]
84+
[SwaggerExclude("POST")]
8285
public async Task Delete(string id)
8386
{
8487
var userId = _userService.GetProperUserId(User).Value;

0 commit comments

Comments
 (0)