Skip to content

Commit

Permalink
Added 'property' field to errors returned from API
Browse files Browse the repository at this point in the history
refs #10438
  • Loading branch information
naz committed Feb 26, 2019
1 parent bd904cd commit 3baf52f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/server/api/v2/utils/validators/utils/json-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const validate = (schema, definitions, data) => {
message: common.i18n.t('notices.data.validation.index.schemaValidationFailed', {
key: key
}),
property: key,
errorDetails: validation.errors
}));
}
Expand Down
1 change: 1 addition & 0 deletions core/server/web/shared/middlewares/error-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ _private.JSONErrorRendererV2 = (err, req, res, next) => { // eslint-disable-line
context: userError.context || null,
type: err.errorType || null,
details: err.errorDetails || null,
property: err.property || null,
help: err.help || null,
code: err.code || null,
id: err.id || null
Expand Down
2 changes: 2 additions & 0 deletions core/test/regression/api/v2/admin/posts_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ describe('Posts API', function () {
'context',
'type',
'details',
'property',
'help',
'code',
'id'
Expand Down Expand Up @@ -203,6 +204,7 @@ describe('Posts API', function () {
'context',
'type',
'details',
'property',
'help',
'code',
'id'
Expand Down
2 changes: 2 additions & 0 deletions core/test/regression/api/v2/admin/settings_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ describe('Settings API', function () {
'context',
'type',
'details',
'property',
'help',
'code',
'id'
Expand Down Expand Up @@ -133,6 +134,7 @@ describe('Settings API', function () {
'context',
'type',
'details',
'property',
'help',
'code',
'id'
Expand Down
2 changes: 2 additions & 0 deletions core/test/regression/api/v2/admin/users_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe('User API', function () {
'context',
'type',
'details',
'property',
'help',
'code',
'id'
Expand Down Expand Up @@ -92,6 +93,7 @@ describe('User API', function () {
'context',
'type',
'details',
'property',
'help',
'code',
'id'
Expand Down

0 comments on commit 3baf52f

Please sign in to comment.