From bac3c4bbe1689a7e80abb99fe74c7a01339466b2 Mon Sep 17 00:00:00 2001 From: jacob Date: Thu, 4 May 2023 16:26:11 -0500 Subject: [PATCH] feat: added error for example-to-schema inconsistency --- .../compile/compileURI/validateParams.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/dredd-transactions/compile/compileURI/validateParams.js b/packages/dredd-transactions/compile/compileURI/validateParams.js index b6a7c4315..d20f7a1ad 100644 --- a/packages/dredd-transactions/compile/compileURI/validateParams.js +++ b/packages/dredd-transactions/compile/compileURI/validateParams.js @@ -33,6 +33,14 @@ module.exports = function validateParams(params) { result.errors.push(text); } } + + // throws error for example-to-schema inconsistency + const example = param.schema.example; + if (param.example !== example) { + text = `URI parameter '${paramName}' example value does not match schema's example value`; + result.errors.push(text); + } + }); return result;