Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rebuild #58

Closed
wants to merge 13 commits into from
18 changes: 13 additions & 5 deletions src/ApiDocumentationElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export class ApiDocumentationElement extends EventsTargetMixin(AmfHelperMixin(Li
this.__amfProcessingDebouncer = false;

let { amf } = this;
this._asyncAPI = this._isAsyncAPI(amf)
if (!amf) {
return;
}
Expand Down Expand Up @@ -391,8 +392,8 @@ export class ApiDocumentationElement extends EventsTargetMixin(AmfHelperMixin(Li
}
}

get server() {
const { serverValue, serverType, selectedType, endpointId: eid, selected: mid } = this;
computeServers(){
const { serverType, selectedType, endpointId: eid, selected: mid } = this;
if (serverType && serverType !== 'server') {
return null;
}
Expand All @@ -403,16 +404,22 @@ export class ApiDocumentationElement extends EventsTargetMixin(AmfHelperMixin(Li
let methodId;
if (selectedType === 'method') {
endpointId = eid;
if(this._isAsyncAPI(this.amf) && this._endpoint){
if(this._asyncAPI && this._endpoint){
endpointId = this._endpoint['@id'];
}
methodId = mid;
} else {
endpointId = mid;
}

const servers = this._getServers({ endpointId, methodId });
this._servers = this._ensureArray(servers)
this._servers = this._getServers({ endpointId, methodId });
return this._servers
}

get server() {
const { serverValue } = this;
this.computeServers()
const servers = this._servers

if (!servers || !servers.length) {
return null;
Expand Down Expand Up @@ -488,6 +495,7 @@ export class ApiDocumentationElement extends EventsTargetMixin(AmfHelperMixin(Li
default:
return;
}
this.computeServers()
this._docsModel = result;
this._viewType = selectedType;
}
Expand Down
Loading