Delivery API: Missing Member Open API security scheme references (#21020)

Use AddComponent for OpenAPI security scheme registration

Fixes security requirements being serialized as empty objects in the
OpenAPI document by using the document's AddComponent method instead
of directly manipulating the SecuritySchemes dictionary.
This commit is contained in:
Laura Neto
2025-12-01 17:24:28 +01:00
committed by GitHub
parent 75b40e79a2
commit 1d59e20daa

View File

@@ -47,9 +47,7 @@ public class ConfigureUmbracoMemberAuthenticationDeliveryApiSwaggerGenOptions :
return; return;
} }
swaggerDoc.Components ??= new OpenApiComponents(); swaggerDoc.AddComponent(
swaggerDoc.Components.SecuritySchemes ??= new Dictionary<string, IOpenApiSecurityScheme>();
swaggerDoc.Components.SecuritySchemes.Add(
AuthSchemeName, AuthSchemeName,
new OpenApiSecurityScheme new OpenApiSecurityScheme
{ {