Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
dataPath property replaced with instancePath
Browse files Browse the repository at this point in the history
  • Loading branch information
jintusebastian committed Feb 19, 2024
1 parent 390cfc4 commit 71e69fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,16 @@ exports.validateSchemaForRequest = function (target, operation) {
validate = validator.compile(schema);
const ajv04Validate = ajv04Validator.compile(schema);
if (!ajv04Validate(parameters) && !validate(parameters)) {
let reason = _.map(validate.errors, ({ dataPath, message }) => `${dataPath} ${message}`).join(', ');
let reason = _.map(validate.errors, ({ instancePath, message }) => `${instancePath} ${message}`).join(', ');
if (reason == '') {
reason = _.map(ajv04Validate.errors, ({ dataPath, message }) => `${dataPath} ${message}`).join(', ');
reason = _.map(ajv04Validate.errors, ({ instancePath, message }) => `${instancePath} ${message}`).join(', ');
}
return next(new InvalidServiceParameters(`Failed to validate service parameters, reason: ${reason}`));
}
} else {
const isValid = validate(parameters);
if (!isValid) {
const reason = _.map(validate.errors, ({ dataPath, message }) => `${dataPath} ${message}`).join(', ');
const reason = _.map(validate.errors, ({ instancePath, message }) => `${instancePath} ${message}`).join(', ');
return next(new InvalidServiceParameters(`Failed to validate service parameters, reason: ${reason}`));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ describe('service-broker-api', function () {
.then(res => {
expect(res).to.have.status(400);
expect(res.body.error).to.be.eql('Bad Request');
expect(res.body.description).to.be.eql('Failed to validate service parameters, reason: undefined must be equal to one of the allowed values');
expect(res.body.description).to.be.eql('Failed to validate service parameters, reason: /enum_foo must be equal to one of the allowed values');
});
});

Expand Down

0 comments on commit 71e69fc

Please sign in to comment.