Skip to content

Commit

Permalink
feat(rulesets): more consistent messages in AsyncAPI ruleset (#1714)
Browse files Browse the repository at this point in the history
* feat(rulesets): more consistent messages in AsyncAPI ruleset

* chore: add ruleset-migrator to tsconfig.json
  • Loading branch information
P0lip committed Jul 6, 2021
1 parent 2a1d2d3 commit 514bb28
Show file tree
Hide file tree
Showing 22 changed files with 58 additions and 60 deletions.
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand All @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down
Expand Up @@ -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,
},
Expand Down

0 comments on commit 514bb28

Please sign in to comment.