diff --git a/packages/ruleset/src/functions/property-case-convention.js b/packages/ruleset/src/functions/property-case-convention.js index c53f6cb6c..307931a17 100644 --- a/packages/ruleset/src/functions/property-case-convention.js +++ b/packages/ruleset/src/functions/property-case-convention.js @@ -25,8 +25,9 @@ function checkPropertyCaseConvention(schema, path) { if (result) { // 'casing' only reports the message - add the path to it // the message itself isn't great either - add some detail to it - result[0].message = 'Property names ' + result[0].message; - result[0].path = [...path, 'properties', propName]; + result[0].message = + 'Property names ' + result[0].message + ': ' + propName; + result[0].path = [...path, 'properties']; errors.push(result[0]); } } diff --git a/packages/ruleset/test/property-case-convention.test.js b/packages/ruleset/test/property-case-convention.test.js index 1693459de..f7fc93690 100644 --- a/packages/ruleset/test/property-case-convention.test.js +++ b/packages/ruleset/test/property-case-convention.test.js @@ -53,7 +53,9 @@ describe('Spectral rule: property-case-convention', () => { const validation = results[0]; expect(validation.code).toBe(name); - expect(validation.message).toBe('Property names must be snake case'); + expect(validation.message).toBe( + 'Property names must be snake case: plotSummary' + ); expect(validation.path).toStrictEqual([ 'paths', '/v1/movies', @@ -62,8 +64,7 @@ describe('Spectral rule: property-case-convention', () => { 'content', 'application/json', 'schema', - 'properties', - 'plotSummary' + 'properties' ]); expect(validation.severity).toBe(expectedSeverity); }); diff --git a/packages/validator/test/cli-validator/tests/expected-output.test.js b/packages/validator/test/cli-validator/tests/expected-output.test.js index fef59d95e..6640da062 100644 --- a/packages/validator/test/cli-validator/tests/expected-output.test.js +++ b/packages/validator/test/cli-validator/tests/expected-output.test.js @@ -180,7 +180,7 @@ describe('cli tool - test expected output - Swagger 2', function() { // errors expect(capturedText[4].match(/\S+/g)[2]).toEqual('59'); - expect(capturedText[8].match(/\S+/g)[2]).toEqual('172'); + expect(capturedText[8].match(/\S+/g)[2]).toEqual('161'); // warnings expect(capturedText[13].match(/\S+/g)[2]).toEqual('59'); expect(capturedText[17].match(/\S+/g)[2]).toEqual('131');