Skip to content

Commit

Permalink
allow no return types on operations
Browse files Browse the repository at this point in the history
  • Loading branch information
abluchet committed Sep 14, 2017
1 parent 33e97f7 commit 7f3aee2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/hydra/parseHydraDocumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,15 @@ export default function parseHydraDocumentation(entrypointUrl, options = {}) {

// Add fields
for (let j = 0; j < entrypointSupportedOperations.length; j++) {
const className = entrypointSupportedOperations[j]['http://www.w3.org/ns/hydra/core#returns'][0]['@id'];
let className = entrypointSupportedOperations[j]['http://www.w3.org/ns/hydra/core#returns'];

// Skip operations not having a return type
if (!className) {
continue;
}

className = className[0]['@id'];

if (0 === className.indexOf('http://www.w3.org/ns/hydra/core')) {
continue;
}
Expand Down
4 changes: 4 additions & 0 deletions src/hydra/parseHydraDocumentation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ test('parse a Hydra documentation', () => {
"hydra:title": "Deletes the Book resource.",
"rdfs:label": "Deletes the Book resource.",
"returns": "owl:Nothing"
},
{
"@type": "hydra:Operation",
"hydra:method": "GET"
}
]
},
Expand Down

0 comments on commit 7f3aee2

Please sign in to comment.