Skip to content

Commit fbdab83

Browse files
fix: Update addSecuritySchema method to correct schema property and add support for various authentication types
1 parent e2cf20c commit fbdab83

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Core.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,25 @@ class OpenAPI {
199199

200200
addSecuritySchema(
201201
name: string,
202-
schema: { type: OpenAPISecurityTypes; schema: string; description?: string }
202+
scheme: {
203+
type: OpenAPISecurityTypes;
204+
scheme?: string; // Correct property for HTTP auth
205+
bearerFormat?: string; // For JWT format specification
206+
name?: string; // For apiKey type
207+
in?: string; // For apiKey type
208+
openIdConnectUrl?: string; // For openIdConnect type
209+
// deno-lint-ignore no-explicit-any
210+
flows?: Record<string, any>; // For oauth2 type
211+
description?: string;
212+
}
203213
): this {
204214
if (!this.raw.components) {
205215
this.raw.components = { securitySchemes: {} };
206216
}
207217
if (!this.raw.components.securitySchemes) {
208218
this.raw.components.securitySchemes = {};
209219
}
210-
this.raw.components.securitySchemes[name] = schema;
220+
this.raw.components.securitySchemes[name] = scheme;
211221
return this;
212222
}
213223
}

0 commit comments

Comments
 (0)