We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 813dd03 commit 4708956Copy full SHA for 4708956
packages/react-openapi/src/resolveOpenAPIOperation.ts
@@ -40,8 +40,12 @@ export async function resolveOpenAPIOperation(
40
}
41
42
const servers = 'servers' in schema ? (schema.servers ?? []) : [];
43
- const security: OpenAPIV3_1.SecurityRequirementObject[] =
44
- operation.security ?? schema.security ?? [];
+ const schemaSecurity = Array.isArray(schema.security)
+ ? schema.security
45
+ : schema.security
46
+ ? [schema.security]
47
+ : [];
48
+ const security: OpenAPIV3_1.SecurityRequirementObject[] = operation.security ?? schemaSecurity;
49
50
// If security includes an empty object, it means that the security is optional
51
const isOptionalSecurity = security.some((entry) => Object.keys(entry).length === 0);
0 commit comments