Skip to content

Commit

Permalink
Check for @odata.type and @type in authorization annotations (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfhandl authored Feb 29, 2020
1 parent f0ec123 commit c8f9767
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/csdl2openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,8 @@ module.exports.csdl2openapi = function (
const scheme = {};
const flow = {};
if (auth.Description) scheme.description = auth.Description;
const type = auth['@type'].substr(auth['@type'].lastIndexOf('.') + 1);
const qualifiedType = auth['@type'] || auth['@odata.type']
const type = qualifiedType.substr(qualifiedType.lastIndexOf('.') + 1);
let unknown = false
switch (type) {
case 'ApiKey':
Expand Down Expand Up @@ -1978,7 +1979,7 @@ module.exports.csdl2openapi = function (
break;
default:
unknown = true
console.warn('Unknown Authorization type ' + auth['@type']);
console.warn('Unknown Authorization type ' + qualifiedType);
}
if (!unknown) schemes[auth.Name] = scheme;
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "odata-openapi",
"version": "0.4.0",
"version": "0.4.1",
"description": "Convert OData CSDL XML or CSDL JSON to OpenAPI",
"homepage": "https://github.com/oasis-tcs/odata-openapi/blob/master/lib/README.md",
"bugs": "https://github.com/oasis-tcs/odata-openapi/issues",
Expand Down

0 comments on commit c8f9767

Please sign in to comment.