Skip to content

Commit 1f10e54

Browse files
feat(W-15520234): add async security method
1 parent 41a0a27 commit 1f10e54

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/ApiMethodDocumentation.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,18 +448,10 @@ export class ApiMethodDocumentation extends AmfHelperMixin(LitElement) {
448448
this.hasCustomProperties = this._computeHasCustomProperties(method);
449449
this.expects = this._computeExpects(method);
450450
this.returns = this._computeReturns(method);
451+
451452
if (this._isAsyncAPI(this.amf)) {
452453
this._overwriteExpects();
453-
454-
// find security from all servers for this endpoint
455-
this.serversSecurity = this.asyncSecurityServers;
456-
457-
// security that is defined by operation
458-
const methodSecurity = this._computeSecurity(method);
459-
460-
// method security that is defined by operation and is not defined by servers
461-
this.methodSecurity = this._computeAsyncSecurityMethod(methodSecurity,this.serversSecurity);
462-
this.security = this.methodSecurity.length>0?this.methodSecurity : this.serversSecurity;
454+
this._computeAsyncApiSecurity()
463455
}else{
464456
this.security = this._computeSecurity(method) || this._computeSecurity(this.server);
465457
}
@@ -473,6 +465,19 @@ export class ApiMethodDocumentation extends AmfHelperMixin(LitElement) {
473465
this.deprecated = this._computeIsDeprecated(method);
474466
}
475467

468+
_computeAsyncApiSecurity(){
469+
const { method } = this;
470+
// find security from all servers for this endpoint
471+
this.serversSecurity = this.asyncSecurityServers;
472+
473+
// security that is defined by operation
474+
const methodSecurity = this._computeSecurity(method);
475+
476+
// method security that is defined by operation and is not defined by servers
477+
this.methodSecurity = this._computeAsyncSecurityMethod(methodSecurity,this.serversSecurity);
478+
this.security = this.methodSecurity.length > 0 ? this.methodSecurity : this.serversSecurity;
479+
}
480+
476481
_computeIsDeprecated(method) {
477482
return Boolean(this._getValue(method, this._getAmfKey(this.ns.aml.vocabularies.core.deprecated)));
478483
}

0 commit comments

Comments
 (0)