Fix az-security-requirement for scope with empty value
This commit is contained in:
Родитель
e7a744d959
Коммит
253e5bdedd
|
@ -53,7 +53,7 @@ module.exports = (input, _, context) => {
|
|||
});
|
||||
}
|
||||
scopes.forEach((scope, scopeIndex) => {
|
||||
if (!scheme.scopes[scope]) {
|
||||
if (!(scope in scheme.scopes)) {
|
||||
errors.push({
|
||||
message: `Scope "${scope}" is not defined for security scheme "${key}".`,
|
||||
path: [...path, index, key, scopeIndex],
|
||||
|
|
|
@ -274,11 +274,22 @@ test('az-security-requirements should find no errors', () => {
|
|||
in: 'header',
|
||||
description: 'API Key for your subscription',
|
||||
},
|
||||
OAuth2Auth: {
|
||||
type: 'oauth2',
|
||||
flow: 'implicit',
|
||||
authorizationUrl: 'https://example.com/oauth2/v2.0/authorize',
|
||||
scopes: {
|
||||
'https://example.com/.default': '',
|
||||
},
|
||||
},
|
||||
},
|
||||
security: [
|
||||
{
|
||||
apim_key: [],
|
||||
},
|
||||
{
|
||||
OAuth2Auth: ['https://example.com/.default'],
|
||||
},
|
||||
],
|
||||
};
|
||||
return linter.run(oasDoc).then((results) => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче