diff --git a/lib/template.js b/lib/template.js index a54e87b..1010c92 100644 --- a/lib/template.js +++ b/lib/template.js @@ -1092,8 +1092,8 @@ class Template { } if (error.keyword === 'enum') { - const allowedValues = error.params.allowedValues; - message = `${message}: ${allowedValues.join(', ')}`; + const allowedValues = error.params.allowedValues.join(', '); + details = `allowed values are: ${allowedValues}`; } if (error.keyword === 'pattern') { diff --git a/test/template.js b/test/template.js index a141d55..4e8f334 100644 --- a/test/template.js +++ b/test/template.js @@ -1349,7 +1349,8 @@ describe('Template class tests', function () { message: 'parameter fooArray[1] should be of type string' }, { - message: 'parameter fooEnum should be equal to one of the allowed values: foo, bar' + message: 'parameter fooEnum should be equal to one of the allowed values', + details: 'allowed values are: foo, bar' }, { message: 'parameter foo should be of type string'