Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.

Commit a877fea

Browse files
committed
Revert error format change
1 parent f4b65c4 commit a877fea

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

osprey-method-handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ function jsonBodyHandler (body, path, methodName, options) {
366366
body.schema, req.body, options.ajv)
367367
if (!report.valid) {
368368
return next(createValidationError(
369-
formatRamlValidationReport(report, 'body')))
369+
formatRamlValidationReport(report, 'json')))
370370
}
371371
return next()
372372
})

test/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ describe('osprey method handler', function () {
753753
app.use(function (err, req, res, next) {
754754
expect(err.ramlValidation).to.equal(true)
755755
expect(err.requestErrors[0]).to.deep.equal({
756-
type: 'body',
756+
type: 'json',
757757
keyword: 'required',
758758
dataPath: '/foo',
759759
message: 'is a required property',
@@ -786,7 +786,7 @@ describe('osprey method handler', function () {
786786
app.use(function (err, req, res, next) {
787787
expect(err.ramlValidation).to.equal(true)
788788
expect(err.requestErrors[0]).to.deep.equal({
789-
type: 'body',
789+
type: 'json',
790790
keyword: 'minProperties',
791791
dataPath: '',
792792
message: 'should NOT have fewer than 2 properties',
@@ -821,7 +821,7 @@ describe('osprey method handler', function () {
821821
app.use(function (err, req, res, next) {
822822
expect(err.ramlValidation).to.equal(true)
823823
expect(err.requestErrors[0]).to.deep.equal({
824-
type: 'body',
824+
type: 'json',
825825
keyword: 'maxProperties',
826826
dataPath: '',
827827
message: 'should NOT have more than 1 properties',
@@ -857,7 +857,7 @@ describe('osprey method handler', function () {
857857
app.use(function (err, req, res, next) {
858858
expect(err.ramlValidation).to.equal(true)
859859
expect(err.requestErrors[0]).to.deep.equal({
860-
type: 'body',
860+
type: 'json',
861861
keyword: 'additionalProperties',
862862
dataPath: '/baz',
863863
message: 'is an invalid additional property',

0 commit comments

Comments
 (0)