fix(openapi-import): spec security should be optional

This commit is contained in:
MrLuje 2023-11-11 14:59:57 +00:00
parent ba761098be
commit a0b2f80508
No known key found for this signature in database

View File

@ -267,12 +267,7 @@ const getDefaultUrl = (serverObject) => {
};
const getSecurity = (apiSpec) => {
let supportedSchemes = apiSpec.security || [];
if (supportedSchemes.length === 0) {
return {
supported: []
};
}
let defaultSchemes = apiSpec.security || [];
let securitySchemes = get(apiSpec, 'components.securitySchemes', {});
if (Object.keys(securitySchemes) === 0) {
@ -282,7 +277,7 @@ const getSecurity = (apiSpec) => {
}
return {
supported: supportedSchemes.map((scheme) => {
supported: defaultSchemes.map((scheme) => {
var schemeName = Object.keys(scheme)[0];
return securitySchemes[schemeName];
}),