From 3a8f344202bdfca952aecd28b1f36be38bbd268c Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Thu, 15 Sep 2022 17:14:35 +0200 Subject: [PATCH] Fix swagger errors (#2277) --- src/Api/Controllers/OrganizationsController.cs | 2 +- src/Api/Controllers/TwoFactorController.cs | 1 + src/Api/Utilities/ServiceCollectionExtensions.cs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Api/Controllers/OrganizationsController.cs b/src/Api/Controllers/OrganizationsController.cs index f38b0dbc3..717fc2a26 100644 --- a/src/Api/Controllers/OrganizationsController.cs +++ b/src/Api/Controllers/OrganizationsController.cs @@ -537,7 +537,7 @@ public class OrganizationsController : Controller } [HttpGet("{id}/api-key-information/{type?}")] - public async Task> ApiKeyInformation(Guid id, OrganizationApiKeyType? type) + public async Task> ApiKeyInformation(Guid id, [FromRoute] OrganizationApiKeyType? type) { if (!await HasApiKeyAccessAsync(id, type)) { diff --git a/src/Api/Controllers/TwoFactorController.cs b/src/Api/Controllers/TwoFactorController.cs index 6ed2b8796..b07f65c4f 100644 --- a/src/Api/Controllers/TwoFactorController.cs +++ b/src/Api/Controllers/TwoFactorController.cs @@ -229,6 +229,7 @@ public class TwoFactorController : Controller } [HttpPost("get-webauthn-challenge")] + [ApiExplorerSettings(IgnoreApi = true)] // Disable Swagger due to CredentialCreateOptions not converting properly public async Task GetWebAuthnChallenge([FromBody] SecretVerificationRequestModel model) { var user = await CheckAsync(model, true); diff --git a/src/Api/Utilities/ServiceCollectionExtensions.cs b/src/Api/Utilities/ServiceCollectionExtensions.cs index ff0ff0705..be3c98be7 100644 --- a/src/Api/Utilities/ServiceCollectionExtensions.cs +++ b/src/Api/Utilities/ServiceCollectionExtensions.cs @@ -28,7 +28,7 @@ public static class ServiceCollectionExtensions }); config.SwaggerDoc("internal", new OpenApiInfo { Title = "Bitwarden Internal API", Version = "latest" }); - config.AddSecurityDefinition("OAuth2 Client Credentials", new OpenApiSecurityScheme + config.AddSecurityDefinition("oauth2-client-credentials", new OpenApiSecurityScheme { Type = SecuritySchemeType.OAuth2, Flows = new OpenApiOAuthFlows @@ -52,7 +52,7 @@ public static class ServiceCollectionExtensions Reference = new OpenApiReference { Type = ReferenceType.SecurityScheme, - Id = "OAuth2 Client Credentials" + Id = "oauth2-client-credentials" }, }, new[] { "api.organization" }