From 514bb28864e3a0d9b59aa5df7d70feb04aa7d903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ro=C5=BCek?= Date: Tue, 6 Jul 2021 15:25:14 +0200 Subject: [PATCH] feat(rulesets): more consistent messages in AsyncAPI ruleset (#1714) * feat(rulesets): more consistent messages in AsyncAPI ruleset * chore: add ruleset-migrator to tsconfig.json --- ...syncapi-channel-no-empty-parameter.test.ts | 2 +- ...capi-channel-no-query-nor-fragment.test.ts | 4 +- ...asyncapi-channel-no-trailing-slash.test.ts | 2 +- ...syncapi-headers-schema-type-object.test.ts | 12 ++--- .../asyncapi-info-contact-properties.test.ts | 2 +- .../__tests__/asyncapi-info-contact.test.ts | 2 +- .../asyncapi-info-description.test.ts | 2 +- .../asyncapi-info-license-url.test.ts | 2 +- .../__tests__/asyncapi-info-license.test.ts | 2 +- .../asyncapi-operation-description.test.ts | 2 +- .../asyncapi-operation-operationId.test.ts | 2 +- .../asyncapi-parameter-description.test.ts | 4 +- ...i-payload-unsupported-schemaFormat.test.ts | 6 +-- .../asyncapi-server-no-empty-variable.test.ts | 2 +- .../asyncapi-server-no-trailing-slash.test.ts | 2 +- .../asyncapi-server-not-example-com.test.ts | 2 +- .../__tests__/asyncapi-servers.test.ts | 4 +- .../asyncapi-tag-description.test.ts | 2 +- .../asyncapi-tags-alphabetical.test.ts | 2 +- .../asyncapi/__tests__/asyncapi-tags.test.ts | 2 +- packages/rulesets/src/asyncapi/index.ts | 46 +++++++++---------- .../scenarios/asyncapi2-streetlights.scenario | 12 ++--- 22 files changed, 58 insertions(+), 60 deletions(-) diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-empty-parameter.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-empty-parameter.test.ts index fd747b067..4b8ad1cc3 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-empty-parameter.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-empty-parameter.test.ts @@ -24,7 +24,7 @@ testRule('asyncapi-channel-no-empty-parameter', [ }, errors: [ { - message: 'Channel path should not have empty parameter substitution pattern.', + message: 'Channel path must not have empty parameter substitution pattern.', path: ['channels', 'users/{}/signedOut'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-query-nor-fragment.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-query-nor-fragment.test.ts index 882b2193b..5a4ffe7aa 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-query-nor-fragment.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-query-nor-fragment.test.ts @@ -24,7 +24,7 @@ testRule('asyncapi-channel-no-query-nor-fragment', [ }, errors: [ { - message: 'Channel path should not include a query (`?`) or a fragment (`#`) delimiter.', + message: 'Channel path must not include query ("?") or fragment ("#") delimiter.', path: ['channels', 'users/{userId}/signedOut?byMistake={didFatFingerTheSignOutButton}'], severity: DiagnosticSeverity.Warning, }, @@ -42,7 +42,7 @@ testRule('asyncapi-channel-no-query-nor-fragment', [ }, errors: [ { - message: 'Channel path should not include a query (`?`) or a fragment (`#`) delimiter.', + message: 'Channel path must not include query ("?") or fragment ("#") delimiter.', path: ['channels', 'users/{userId}/signedOut#onPurpose'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-trailing-slash.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-trailing-slash.test.ts index 1e1ea4c00..9766afaa9 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-trailing-slash.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-channel-no-trailing-slash.test.ts @@ -24,7 +24,7 @@ testRule('asyncapi-channel-no-trailing-slash', [ }, errors: [ { - message: 'Channel path should not end with a slash.', + message: 'Channel path must not end with slash.', path: ['channels', 'users/{userId}/signedOut/'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-headers-schema-type-object.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-headers-schema-type-object.test.ts index b86ec3694..e3d6cc178 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-headers-schema-type-object.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-headers-schema-type-object.test.ts @@ -52,7 +52,7 @@ testRule('asyncapi-headers-schema-type-object', [ errors: [ { message: - 'Headers schema type must be `object` (`type` property must be equal to one of the allowed values: `object`. Did you mean `object`?).', + 'Headers schema type must be "object" (`type` property must be equal to one of the allowed values: `object`. Did you mean `object`?).', path: ['components', 'messages', 'aMessage', 'headers', 'type'], severity: DiagnosticSeverity.Error, }, @@ -66,7 +66,7 @@ testRule('asyncapi-headers-schema-type-object', [ }), errors: [ { - message: 'Headers schema type must be `object` (`headers` property must have required property `type`).', + message: 'Headers schema type must be "object" (`headers` property must have required property `type`).', path: ['components', 'messages', 'aMessage', 'headers'], severity: DiagnosticSeverity.Error, }, @@ -81,7 +81,7 @@ testRule('asyncapi-headers-schema-type-object', [ errors: [ { message: - 'Headers schema type must be `object` (`type` property must be equal to one of the allowed values: `object`. Did you mean `object`?).', + 'Headers schema type must be "object" (`type` property must be equal to one of the allowed values: `object`. Did you mean `object`?).', path: ['components', 'messageTraits', 'aTrait', 'headers', 'type'], severity: DiagnosticSeverity.Error, }, @@ -95,7 +95,7 @@ testRule('asyncapi-headers-schema-type-object', [ }), errors: [ { - message: 'Headers schema type must be `object` (`headers` property must have required property `type`).', + message: 'Headers schema type must be "object" (`headers` property must have required property `type`).', path: ['components', 'messageTraits', 'aTrait', 'headers'], severity: DiagnosticSeverity.Error, }, @@ -110,7 +110,7 @@ testRule('asyncapi-headers-schema-type-object', [ }), errors: [ { - message: 'Headers schema type must be `object` (`headers` property must have required property `type`).', + message: 'Headers schema type must be "object" (`headers` property must have required property `type`).', path: ['channels', 'users/{userId}/signedUp', property, 'message', 'headers'], severity: DiagnosticSeverity.Error, }, @@ -125,7 +125,7 @@ testRule('asyncapi-headers-schema-type-object', [ errors: [ { message: - 'Headers schema type must be `object` (`type` property must be equal to one of the allowed values: `object`. Did you mean `object`?).', + 'Headers schema type must be "object" (`type` property must be equal to one of the allowed values: `object`. Did you mean `object`?).', path: ['channels', 'users/{userId}/signedUp', property, 'message', 'headers', 'type'], severity: DiagnosticSeverity.Error, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-contact-properties.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-contact-properties.test.ts index e2cf89b60..1f6192e72 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-contact-properties.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-contact-properties.test.ts @@ -27,7 +27,7 @@ testRule('asyncapi-info-contact-properties', [ }), errors: [ { - message: 'Contact object should have `name`, `url` and `email`.', + message: 'Contact object must have "name", "url" and "email".', path: ['info', 'contact'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-contact.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-contact.test.ts index c822dc519..edd04fb25 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-contact.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-contact.test.ts @@ -25,7 +25,7 @@ testRule('asyncapi-info-contact', [ }, errors: [ { - message: 'Info object should contain `contact` object.', + message: 'Info object must have "contact" object.', path: ['info'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-description.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-description.test.ts index 48e59d033..437c8cac5 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-description.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-description.test.ts @@ -20,7 +20,7 @@ testRule('asyncapi-info-description', [ }, errors: [ { - message: 'AsyncAPI object info `description` must be present and non-empty string.', + message: 'Info "description" must be present and non-empty string.', path: ['info'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-license-url.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-license-url.test.ts index 1183ccb84..bbef37d38 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-license-url.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-license-url.test.ts @@ -25,7 +25,7 @@ testRule('asyncapi-info-license-url', [ }, errors: [ { - message: 'License object should include `url`.', + message: 'License object must include "url".', path: ['info', 'license'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-license.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-license.test.ts index b695bc69d..c0ad7802f 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-license.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-info-license.test.ts @@ -23,7 +23,7 @@ testRule('asyncapi-info-license', [ }, errors: [ { - message: 'AsyncAPI object should contain `license` object.', + message: 'Info object must have "license" object.', path: ['info'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-operation-description.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-operation-description.test.ts index b17c85b38..a1dc7fc85 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-operation-description.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-operation-description.test.ts @@ -30,7 +30,7 @@ testRule('asyncapi-operation-description', [ }), errors: [ { - message: 'Operation `description` must be present and non-empty string.', + message: 'Operation "description" must be present and non-empty string.', path: ['channels', 'one', property], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-operation-operationId.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-operation-operationId.test.ts index c3ee9b08d..3fb28b79f 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-operation-operationId.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-operation-operationId.test.ts @@ -30,7 +30,7 @@ testRule('asyncapi-operation-operationId', [ }), errors: [ { - message: 'Operation should have an `operationId`.', + message: 'Operation must have "operationId".', path: ['channels', 'one', property], severity: DiagnosticSeverity.Error, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-parameter-description.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-parameter-description.test.ts index 55d29c98f..a338f960f 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-parameter-description.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-parameter-description.test.ts @@ -36,7 +36,7 @@ testRule('asyncapi-parameter-description', [ }), errors: [ { - message: 'Parameter objects should have a `description`.', + message: 'Parameter objects must have "description".', path: ['channels', 'users/{userId}/signedUp', 'parameters', 'userId'], severity: DiagnosticSeverity.Warning, }, @@ -50,7 +50,7 @@ testRule('asyncapi-parameter-description', [ }), errors: [ { - message: 'Parameter objects should have a `description`.', + message: 'Parameter objects must have "description".', path: ['components', 'parameters', 'orphanParameter'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-payload-unsupported-schemaFormat.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-payload-unsupported-schemaFormat.test.ts index 3563b3639..76c6e5ce7 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-payload-unsupported-schemaFormat.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-payload-unsupported-schemaFormat.test.ts @@ -38,7 +38,7 @@ testRule('asyncapi-payload-unsupported-schemaFormat', [ }), errors: [ { - message: 'Message schema validation is only supported with default unspecified `schemaFormat`.', + message: 'Message schema validation is only supported with default unspecified "schemaFormat".', path: ['components', 'messages', 'aMessage', 'schemaFormat'], severity: DiagnosticSeverity.Information, }, @@ -52,7 +52,7 @@ testRule('asyncapi-payload-unsupported-schemaFormat', [ }), errors: [ { - message: 'Message schema validation is only supported with default unspecified `schemaFormat`.', + message: 'Message schema validation is only supported with default unspecified "schemaFormat".', path: ['components', 'messageTraits', 'aTrait', 'schemaFormat'], severity: DiagnosticSeverity.Information, }, @@ -66,7 +66,7 @@ testRule('asyncapi-payload-unsupported-schemaFormat', [ }), errors: [ { - message: 'Message schema validation is only supported with default unspecified `schemaFormat`.', + message: 'Message schema validation is only supported with default unspecified "schemaFormat".', path: ['channels', 'users/{userId}/signedUp', property, 'message', 'schemaFormat'], severity: DiagnosticSeverity.Information, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-no-empty-variable.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-no-empty-variable.test.ts index e8dc74eed..74580ad7c 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-no-empty-variable.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-no-empty-variable.test.ts @@ -28,7 +28,7 @@ testRule('asyncapi-server-no-empty-variable', [ }, errors: [ { - message: 'Server URL should not have empty variable substitution pattern.', + message: 'Server URL must not have empty variable substitution pattern.', path: ['servers', 'production', 'url'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-no-trailing-slash.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-no-trailing-slash.test.ts index 96d112cc5..0be910ce1 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-no-trailing-slash.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-no-trailing-slash.test.ts @@ -29,7 +29,7 @@ testRule('asyncapi-server-no-trailing-slash', [ }, errors: [ { - message: 'Server URL should not end with a slash.', + message: 'Server URL must not end with slash.', path: ['servers', 'production', 'url'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-not-example-com.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-not-example-com.test.ts index d2b00f24f..0abea37ae 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-not-example-com.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-server-not-example-com.test.ts @@ -29,7 +29,7 @@ testRule('asyncapi-server-not-example-com', [ }, errors: [ { - message: 'Server URL should not point at example.com.', + message: 'Server URL must not point at example.com.', path: ['servers', 'production', 'url'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-servers.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-servers.test.ts index 93a831df8..6f4e9110d 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-servers.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-servers.test.ts @@ -23,7 +23,7 @@ testRule('asyncapi-servers', [ }, errors: [ { - message: 'AsyncAPI object should contain a non empty `servers` object.', + message: 'AsyncAPI object must have non-empty "servers" object.', path: [], severity: DiagnosticSeverity.Warning, }, @@ -38,7 +38,7 @@ testRule('asyncapi-servers', [ }, errors: [ { - message: 'AsyncAPI object should contain a non empty `servers` object.', + message: 'AsyncAPI object must have non-empty "servers" object.', path: ['servers'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-tag-description.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-tag-description.test.ts index 1fdc1acfe..49d169cb9 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-tag-description.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-tag-description.test.ts @@ -28,7 +28,7 @@ testRule('asyncapi-tag-description', [ }, errors: [ { - message: 'Tag object should have a `description`.', + message: 'Tag object must have "description".', path: ['tags', '0'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-tags-alphabetical.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-tags-alphabetical.test.ts index 38f54b4ba..13615ac3e 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-tags-alphabetical.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-tags-alphabetical.test.ts @@ -19,7 +19,7 @@ testRule('asyncapi-tags-alphabetical', [ }, errors: [ { - message: 'AsyncAPI object should have alphabetical `tags`.', + message: 'AsyncAPI object must have alphabetical "tags".', path: ['tags'], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/__tests__/asyncapi-tags.test.ts b/packages/rulesets/src/asyncapi/__tests__/asyncapi-tags.test.ts index 81a8e4ae9..2f7894730 100644 --- a/packages/rulesets/src/asyncapi/__tests__/asyncapi-tags.test.ts +++ b/packages/rulesets/src/asyncapi/__tests__/asyncapi-tags.test.ts @@ -18,7 +18,7 @@ testRule('asyncapi-tags', [ }, errors: [ { - message: 'AsyncAPI object should have non-empty `tags` array.', + message: 'AsyncAPI object must have non-empty "tags" array.', path: [], severity: DiagnosticSeverity.Warning, }, diff --git a/packages/rulesets/src/asyncapi/index.ts b/packages/rulesets/src/asyncapi/index.ts index 330e4f468..656aa1a4e 100644 --- a/packages/rulesets/src/asyncapi/index.ts +++ b/packages/rulesets/src/asyncapi/index.ts @@ -12,14 +12,12 @@ import asyncApi2SchemaValidation from './functions/asyncApi2SchemaValidation'; import asyncApi2PayloadValidation from './functions/asyncApi2PayloadValidation'; import * as asyncApi2Schema from './schemas/schema.asyncapi2.json'; -export { ruleset as default }; - -const ruleset = { +export default { documentationUrl: 'https://meta.stoplight.io/docs/spectral/docs/reference/asyncapi-rules.md', formats: [asyncApi2], rules: { 'asyncapi-channel-no-empty-parameter': { - description: 'Channel path should not have empty parameter substitution pattern.', + description: 'Channel path must not have empty parameter substitution pattern.', recommended: true, type: 'style', given: '$.channels.*~', @@ -31,7 +29,7 @@ const ruleset = { }, }, 'asyncapi-channel-no-query-nor-fragment': { - description: 'Channel path should not include a query (`?`) or a fragment (`#`) delimiter.', + description: 'Channel path must not include query ("?") or fragment ("#") delimiter.', recommended: true, type: 'style', given: '$.channels.*~', @@ -43,7 +41,7 @@ const ruleset = { }, }, 'asyncapi-channel-no-trailing-slash': { - description: 'Channel path should not end with a slash.', + description: 'Channel path must not end with slash.', recommended: true, type: 'style', given: '$.channels.*~', @@ -55,8 +53,8 @@ const ruleset = { }, }, 'asyncapi-headers-schema-type-object': { - description: 'Headers schema type must be `object`.', - message: 'Headers schema type must be `object` ({{error}}).', + description: 'Headers schema type must be "object".', + message: 'Headers schema type must be "object" ({{error}}).', severity: 'error', recommended: true, type: 'validation', @@ -82,7 +80,7 @@ const ruleset = { }, }, 'asyncapi-info-contact-properties': { - description: 'Contact object should have `name`, `url` and `email`.', + description: 'Contact object must have "name", "url" and "email".', recommended: true, type: 'style', given: '$.info.contact', @@ -102,7 +100,7 @@ const ruleset = { ], }, 'asyncapi-info-contact': { - description: 'Info object should contain `contact` object.', + description: 'Info object must have "contact" object.', recommended: true, type: 'style', given: '$', @@ -112,7 +110,7 @@ const ruleset = { }, }, 'asyncapi-info-description': { - description: 'AsyncAPI object info `description` must be present and non-empty string.', + description: 'Info "description" must be present and non-empty string.', recommended: true, type: 'style', given: '$', @@ -122,7 +120,7 @@ const ruleset = { }, }, 'asyncapi-info-license-url': { - description: 'License object should include `url`.', + description: 'License object must include "url".', recommended: false, type: 'style', given: '$', @@ -132,7 +130,7 @@ const ruleset = { }, }, 'asyncapi-info-license': { - description: 'AsyncAPI object should contain `license` object.', + description: 'Info object must have "license" object.', recommended: true, type: 'style', given: '$', @@ -142,7 +140,7 @@ const ruleset = { }, }, 'asyncapi-operation-description': { - description: 'Operation `description` must be present and non-empty string.', + description: 'Operation "description" must be present and non-empty string.', recommended: true, type: 'style', given: ['$.channels.*.[publish,subscribe]'], @@ -152,7 +150,7 @@ const ruleset = { }, }, 'asyncapi-operation-operationId': { - description: 'Operation should have an `operationId`.', + description: 'Operation must have "operationId".', severity: 'error', recommended: true, type: 'validation', @@ -163,7 +161,7 @@ const ruleset = { }, }, 'asyncapi-parameter-description': { - description: 'Parameter objects should have a `description`.', + description: 'Parameter objects must have "description".', recommended: false, type: 'style', given: ['$.components.parameters.*', '$.channels.*.parameters.*'], @@ -209,7 +207,7 @@ const ruleset = { }, }, 'asyncapi-payload-unsupported-schemaFormat': { - description: 'Message schema validation is only supported with default unspecified `schemaFormat`.', + description: 'Message schema validation is only supported with default unspecified "schemaFormat".', severity: 'info', recommended: true, type: 'validation', @@ -286,7 +284,7 @@ const ruleset = { }, }, 'asyncapi-server-no-empty-variable': { - description: 'Server URL should not have empty variable substitution pattern.', + description: 'Server URL must not have empty variable substitution pattern.', recommended: true, type: 'style', given: '$.servers[*].url', @@ -298,7 +296,7 @@ const ruleset = { }, }, 'asyncapi-server-no-trailing-slash': { - description: 'Server URL should not end with a slash.', + description: 'Server URL must not end with slash.', recommended: true, type: 'style', given: '$.servers[*].url', @@ -310,7 +308,7 @@ const ruleset = { }, }, 'asyncapi-server-not-example-com': { - description: 'Server URL should not point at example.com.', + description: 'Server URL must not point at example.com.', recommended: false, type: 'style', given: '$.servers[*].url', @@ -322,7 +320,7 @@ const ruleset = { }, }, 'asyncapi-servers': { - description: 'AsyncAPI object should contain a non empty `servers` object.', + description: 'AsyncAPI object must have non-empty "servers" object.', recommended: true, type: 'validation', given: '$', @@ -339,7 +337,7 @@ const ruleset = { }, }, 'asyncapi-tag-description': { - description: 'Tag object should have a `description`.', + description: 'Tag object must have "description".', recommended: false, type: 'style', given: '$.tags[*]', @@ -349,7 +347,7 @@ const ruleset = { }, }, 'asyncapi-tags-alphabetical': { - description: 'AsyncAPI object should have alphabetical `tags`.', + description: 'AsyncAPI object must have alphabetical "tags".', recommended: false, type: 'style', given: '$', @@ -362,7 +360,7 @@ const ruleset = { }, }, 'asyncapi-tags': { - description: 'AsyncAPI object should have non-empty `tags` array.', + description: 'AsyncAPI object must have non-empty "tags" array.', recommended: true, type: 'style', given: '$', diff --git a/test-harness/scenarios/asyncapi2-streetlights.scenario b/test-harness/scenarios/asyncapi2-streetlights.scenario index b29f6dd1b..e442a7686 100644 --- a/test-harness/scenarios/asyncapi2-streetlights.scenario +++ b/test-harness/scenarios/asyncapi2-streetlights.scenario @@ -217,11 +217,11 @@ module.exports = asyncapi; {bin} lint {document} --ruleset {asset:ruleset} ====stdout==== {document} - 1:1 warning asyncapi-tags AsyncAPI object should have non-empty `tags` array. - 2:6 warning asyncapi-info-contact Info object should contain `contact` object. info - 45:13 warning asyncapi-operation-description Operation `description` must be present and non-empty string. channels.smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured.publish - 57:15 warning asyncapi-operation-description Operation `description` must be present and non-empty string. channels.smartylighting/streetlights/1/0/action/{streetlightId}/turn/on.subscribe - 68:15 warning asyncapi-operation-description Operation `description` must be present and non-empty string. channels.smartylighting/streetlights/1/0/action/{streetlightId}/turn/off.subscribe - 79:15 warning asyncapi-operation-description Operation `description` must be present and non-empty string. channels.smartylighting/streetlights/1/0/action/{streetlightId}/dim.subscribe + 1:1 warning asyncapi-tags AsyncAPI object must have non-empty "tags" array. + 2:6 warning asyncapi-info-contact Info object must have "contact" object. info + 45:13 warning asyncapi-operation-description Operation "description" must be present and non-empty string. channels.smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured.publish + 57:15 warning asyncapi-operation-description Operation "description" must be present and non-empty string. channels.smartylighting/streetlights/1/0/action/{streetlightId}/turn/on.subscribe + 68:15 warning asyncapi-operation-description Operation "description" must be present and non-empty string. channels.smartylighting/streetlights/1/0/action/{streetlightId}/turn/off.subscribe + 79:15 warning asyncapi-operation-description Operation "description" must be present and non-empty string. channels.smartylighting/streetlights/1/0/action/{streetlightId}/dim.subscribe ✖ 6 problems (0 errors, 6 warnings, 0 infos, 0 hints)