in core/routemgmt/common/utils.js [506:587]
function addEndpointToSwaggerApi(swaggerApi, endpoint) {
var operation = endpoint.gatewayMethod.toLowerCase();
var auth_base64 = Buffer.from(endpoint.action.authkey,'ascii').toString('base64');
// If the relative path already exists, append to it; otherwise create it
if (!swaggerApi.paths[endpoint.gatewayPath]) {
swaggerApi.paths[endpoint.gatewayPath] = {};
}
swaggerApi.paths[endpoint.gatewayPath][operation] = {
'x-ibm-op-ext': {
backendMethod: endpoint.action.backendMethod,
backendUrl: endpoint.action.backendUrl,
actionName: endpoint.action.name,
actionNamespace: endpoint.action.namespace,
policies: [
{
type: 'reqMapping',
value: [
{
action: 'transform',
from: {
name: '*',
location: 'query'
},
to: {
name: '*',
location: 'body'
}
},
{
action: 'insert',
from: {
value: 'Basic '+auth_base64
},
to: {
name: 'Authorization',
location: 'header'
}
},
{
action: 'insert',
from: {
value: 'application/json'
},
to: {
name: 'Content-Type',
location: 'header'
}
},
{
action: 'insert',
from: {
value: 'true'
},
to: {
name: 'blocking',
location: 'query'
}
},
{
action: 'insert',
from: {
value: 'true'
},
to: {
name: 'result',
location: 'query'
}
}
]
}
]
},
responses: {
default: {
description: "Default response"
}
}
};
return swaggerApi;
}