Skip to content

Commit

Permalink
Merge pull request #573 from mihalicyn/patch-1
Browse files Browse the repository at this point in the history
fix: issue when field examples not appear correctly in swagger.json and swagger-ui
  • Loading branch information
robmcguinness committed Mar 8, 2019
2 parents e4cff5d + 77fb50b commit 9a57398
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ internals.properties.prototype.parsePropertyMetadata = function (property, name,
internals.convertRules(property, describe.rules, [
'unit'
], 'x-format');
property.example = Hoek.reach(joiObj, '_examples.0');
let exampleObj = Hoek.reach(joiObj, '_examples.0');
/* $lab:coverage:off$ */
property.example = exampleObj && exampleObj.value ? exampleObj.value : exampleObj;
/* $lab:coverage:on$ */
property['x-meta'] = Hoek.reach(joiObj, '_meta.0');
}

Expand Down

0 comments on commit 9a57398

Please sign in to comment.