Merge pull request #953 from MrLuje/fix/openapi-import

fix(openapi-import): root security should be optional
This commit is contained in:
Anoop M D 2023-11-12 23:56:19 +05:30 committed by GitHub
commit f617504cd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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];
}),