Skip to content

Commit

Permalink
minor correction
Browse files Browse the repository at this point in the history
  • Loading branch information
RoshniNaveenaS committed Aug 27, 2024
1 parent 020aaf7 commit d17c92f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/compile/csdl2openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ module.exports.csdl2openapi = function (
// if csdl.$Version is 4.01 then protocol is rest if it is less than 4.01 then protocol is odata
const protocol = csdl.$Version <= '4.01' ? 'odata/v4' : 'rest';
// append /protocol/{$serviceName} to the URL
servers.forEach(server => { server.url = server.url + '/' + protocol + csdl.$EntityContainer });
servers.forEach(server => { server.url = server.url + '/' + protocol + '/' + csdl.$EntityContainer });
} catch (err) {
throw new Error(`The input server object is invalid.`);
}
Expand Down
2 changes: 1 addition & 1 deletion test/lib/compile/openapi.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ describe('OpenAPI export', () => {
const serverObj = "[{\n \"url\": \"https://{customer1Id}.saas-app.com:{port}/v2\",\n \"variables\": {\n \"customer1Id\": \"demo\",\n \"description\": \"Customer1 ID assigned by the service provider\"\n }\n}, {\n \"url\": \"https://{customer2Id}.saas-app.com:{port}/v2\",\n \"variables\": {\n \"customer2Id\": \"demo\",\n \"description\": \"Customer2 ID assigned by the service provider\"\n }\n}]"
const openapi = toOpenApi(csn, { 'openapi:servers': serverObj });
expect(openapi.servers).toBeTruthy();
expect(openapi.servers[0].url).toMatch('https://{customer1Id}.saas-app.com:{port}/v2/odata/v4A.EntityContainer')
expect(openapi.servers[0].url).toMatch('https://{customer1Id}.saas-app.com:{port}/v2/odata/v4/A.EntityContainer')
});


Expand Down

0 comments on commit d17c92f

Please sign in to comment.