Skip to content

Commit

Permalink
feat(ls): make lint messages more helpful (#2930)
Browse files Browse the repository at this point in the history
This PR changes the error messages for type linting
rules for OpenAPI 3.0.x, OpenAPI 3.1, AsyncAPI 2.0
and AsyncAPI 2.1-2.6 to include the information about
allowed values for the type field.
  • Loading branch information
damian-polewski-sb authored Jul 11, 2023
1 parent cc11a61 commit 4504674
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { LinterMeta } from '../../../../apidom-language-types';
const typeEqualsLint2_0: LinterMeta = {
code: ApilintCodes.ASYNCAPI2_SECURITY_SCHEME_FIELD_TYPE_EQUALS_2_2,
source: 'apilint',
message: 'type must be one of allowed values',
message:
'type must be one of allowed values: userPassword, apiKey, X509, symmetricEncryption, asymmetricEncryption, httpApiKey, http, oauth2, openIdConnect',
severity: DiagnosticSeverity.Error,
targetSpecs: [{ namespace: 'asyncapi', version: '2.0.0' }],
linterFunction: 'apilintValueOrArray',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { LinterMeta } from '../../../../apidom-language-types';
const typeEqualsLint2_1__2_6Lint: LinterMeta = {
code: ApilintCodes.ASYNCAPI2_SECURITY_SCHEME_FIELD_TYPE_EQUALS_2_2__2_6,
source: 'apilint',
message: 'type must be one of allowed values',
message:
'type must be one of allowed values: userPassword, apiKey, X509, symmetricEncryption, asymmetricEncryption, httpApiKey, http, oauth2, openIdConnect, plain, scramSha256, scramSha512, gssapi',
severity: DiagnosticSeverity.Error,
linterFunction: 'apilintValueOrArray',
linterParams: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LinterMeta } from '../../../../apidom-language-types';
const typeEquals3_0Lint: LinterMeta = {
code: ApilintCodes.OPENAPI3_0_SECURITY_SCHEME_FIELD_TYPE_EQUALS,
source: 'apilint',
message: 'type must be one of allowed values',
message: 'type must be one of allowed values: apiKey, http, oauth2, openIdConnect',
severity: DiagnosticSeverity.Error,
linterFunction: 'apilintValueOrArray',
linterParams: [['apiKey', 'http', 'oauth2', 'openIdConnect']],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LinterMeta } from '../../../../apidom-language-types';
const typeEquals3_1Lint: LinterMeta = {
code: ApilintCodes.OPENAPI3_1_SECURITY_SCHEME_FIELD_TYPE_EQUALS,
source: 'apilint',
message: 'type must be one of allowed values',
message: 'type must be one of allowed values: apiKey, http, mutualTLS, oauth2, openIdConnect',
severity: DiagnosticSeverity.Error,
linterFunction: 'apilintValueOrArray',
linterParams: [['apiKey', 'http', 'mutualTLS', 'oauth2', 'openIdConnect']],
Expand Down

0 comments on commit 4504674

Please sign in to comment.