-
Notifications
You must be signed in to change notification settings - Fork 22
feat(ls): update Anypoint MQ Bindings #5128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
48a52c8
e9bc8bd
7fe1558
6ca934c
3de4551
37bede5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| import { | ||
| ApidomCompletionItem, | ||
| CompletionFormat, | ||
| CompletionType, | ||
| } from '../../../../../../apidom-language-types.ts'; | ||
|
|
||
| const completion: ApidomCompletionItem[] = [ | ||
| { | ||
| label: 'destination', | ||
| insertText: 'destination', | ||
| kind: 14, | ||
| format: CompletionFormat.QUOTED, | ||
| type: CompletionType.PROPERTY, | ||
| insertTextFormat: 2, | ||
| documentation: { | ||
| kind: 'markdown', | ||
| value: | ||
| '**Optional**, defaults to the channel name. The destination (queue or exchange) name for this channel. SHOULD only be specified if the channel name differs from the actual destination name, such as when the channel name is not a valid destination name in Anypoint MQ.', | ||
| }, | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| label: 'destinationType', | ||
| insertText: 'destinationType', | ||
| kind: 14, | ||
| format: CompletionFormat.QUOTED, | ||
| type: CompletionType.PROPERTY, | ||
| insertTextFormat: 2, | ||
| documentation: { | ||
| kind: 'markdown', | ||
| value: | ||
| '**Optional**, defaults to `queue`. The type of destination, which MUST be either `exchange` or `queue` or `fifo-queue`. SHOULD be specified to document the messaging model (publish/subscribe, point-to-point, strict message ordering) supported by this channel.', | ||
| }, | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| target: 'destinationType', | ||
| label: 'destinationType', | ||
| insertText: 'exchange', | ||
| kind: 12, | ||
| format: CompletionFormat.QUOTED, | ||
| type: CompletionType.VALUE, | ||
| insertTextFormat: 2, | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| target: 'destinationType', | ||
| label: 'destinationType', | ||
| insertText: 'queue', | ||
| kind: 12, | ||
| format: CompletionFormat.QUOTED, | ||
| type: CompletionType.VALUE, | ||
| insertTextFormat: 2, | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }, | ||
| { | ||
| target: 'destinationType', | ||
| label: 'destinationType', | ||
| insertText: 'fifo-queue', | ||
| kind: 12, | ||
| format: CompletionFormat.QUOTED, | ||
| type: CompletionType.VALUE, | ||
| insertTextFormat: 2, | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }, | ||
| ]; | ||
|
|
||
| export default completion; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
|
||
| import ApilintCodes from '../../../../../../codes.ts'; | ||
| import { LinterMeta } from '../../../../../../../apidom-language-types.ts'; | ||
|
|
||
| const allowedFieldsLint: LinterMeta = { | ||
| code: ApilintCodes.NOT_ALLOWED_FIELDS, | ||
| source: 'apilint', | ||
| message: 'Object includes not allowed fields', | ||
| severity: DiagnosticSeverity.Error, | ||
| linterFunction: 'allowedFields', | ||
| linterParams: [['destination', 'destinationType', 'bindingVersion']], | ||
| marker: 'key', | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export default allowedFieldsLint; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
|
||
| import ApilintCodes from '../../../../../../codes.ts'; | ||
| import { LinterMeta } from '../../../../../../../apidom-language-types.ts'; | ||
|
|
||
| const destinationTypeLint: LinterMeta = { | ||
| code: ApilintCodes.ASYNCAPI2_ANYPOINTMQ_CHANNEL_BINDING_FIELD_DESTINATION_TYPE, | ||
| source: 'apilint', | ||
| message: "'destination' value must be a string", | ||
| severity: DiagnosticSeverity.Error, | ||
| linterFunction: 'apilintType', | ||
| linterParams: ['string'], | ||
| marker: 'value', | ||
| target: 'destination', | ||
| data: {}, | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export default destinationTypeLint; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
|
||
| import ApilintCodes from '../../../../../../codes.ts'; | ||
| import { LinterMeta } from '../../../../../../../apidom-language-types.ts'; | ||
|
|
||
| const destinationTypeTypeLint: LinterMeta = { | ||
| code: ApilintCodes.ASYNCAPI2_ANYPOINTMQ_CHANNEL_BINDING_FIELD_DESTINATION_TYPE_TYPE, | ||
| source: 'apilint', | ||
| message: "'destinationType' value must be a string", | ||
| severity: DiagnosticSeverity.Error, | ||
| linterFunction: 'apilintType', | ||
| linterParams: ['string'], | ||
| marker: 'value', | ||
| target: 'destinationType', | ||
| data: {}, | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export default destinationTypeTypeLint; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import allowedFieldsLint from './allowed-fields.ts'; | ||
| import destinationTypeLint from './destination--type.ts'; | ||
| import destinationTypeTypeLint from './destination-type--type.ts'; | ||
|
|
||
| const lints = [destinationTypeLint, destinationTypeTypeLint, allowedFieldsLint]; | ||
|
|
||
| export default lints; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| import channelBinding0_0_1Lints from './0-0-1/index.ts'; | ||
| import channelBinding0_1_0Lints from './0-1-0/index.ts'; | ||
| import channelBindingLatestLints from './latest/index.ts'; | ||
| import bindingVersionTypeLint from './binding-version--type.ts'; | ||
|
|
||
| const lints = [...channelBinding0_0_1Lints, ...channelBindingLatestLints, bindingVersionTypeLint]; | ||
| const lints = [ | ||
| ...channelBinding0_0_1Lints, | ||
| ...channelBinding0_1_0Lints, | ||
| ...channelBindingLatestLints, | ||
| bindingVersionTypeLint, | ||
| ]; | ||
|
|
||
| export default lints; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { | ||
| ApidomCompletionItem, | ||
| CompletionFormat, | ||
| CompletionType, | ||
| } from '../../../../../../apidom-language-types.ts'; | ||
|
|
||
| const completion: ApidomCompletionItem[] = [ | ||
| { | ||
| label: 'headers', | ||
| insertText: 'headers', | ||
| kind: 14, | ||
| format: CompletionFormat.OBJECT, | ||
| type: CompletionType.PROPERTY, | ||
| insertTextFormat: 2, | ||
| documentation: { | ||
| kind: 'markdown', | ||
| value: | ||
| '[Schema object](https://www.asyncapi.com/docs/reference/specification/v2.6.0#schemaObject)\n\\\n\\\n**Optional**. A Schema object containing the definitions for Anypoint MQ-specific headers (so-called protocol headers). This schema MUST be of type `object` and have a `properties` key. Examples of Anypoint MQ protocol headers are `messageId` and `messageGroupId`.', | ||
|
||
| }, | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }, | ||
| ]; | ||
|
|
||
| export default completion; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
|
||
| import ApilintCodes from '../../../../../../codes.ts'; | ||
| import { LinterMeta } from '../../../../../../../apidom-language-types.ts'; | ||
|
|
||
| const allowedFieldsLint: LinterMeta = { | ||
| code: ApilintCodes.NOT_ALLOWED_FIELDS, | ||
| source: 'apilint', | ||
| message: 'Object includes not allowed fields', | ||
| severity: DiagnosticSeverity.Error, | ||
| linterFunction: 'allowedFields', | ||
| linterParams: [['headers', 'bindingVersion']], | ||
| marker: 'key', | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export default allowedFieldsLint; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { DiagnosticSeverity } from 'vscode-languageserver-types'; | ||
|
|
||
| import ApilintCodes from '../../../../../../codes.ts'; | ||
| import { LinterMeta } from '../../../../../../../apidom-language-types.ts'; | ||
|
|
||
| const headersTypeLint: LinterMeta = { | ||
| code: ApilintCodes.ASYNCAPI2_ANYPOINTMQ_MESSAGE_BINDING_FIELD_HEADERS_TYPE, | ||
| source: 'apilint', | ||
| message: 'headers must be an object or a boolean JSON schema', | ||
| severity: DiagnosticSeverity.Error, | ||
| linterFunction: 'apilintElementOrClass', | ||
| linterParams: [['schema', 'boolean']], | ||
| marker: 'value', | ||
| target: 'headers', | ||
| data: {}, | ||
| conditions: [ | ||
| { | ||
| targets: [{ path: 'bindingVersion' }], | ||
| function: 'apilintValueOrArray', | ||
| params: [['0.1.0']], | ||
| }, | ||
| ], | ||
| }; | ||
|
|
||
| export default headersTypeLint; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import allowedFieldsLint from './allowed-fields.ts'; | ||
| import headersTypeLint from './headers--type.ts'; | ||
|
|
||
| const lints = [allowedFieldsLint, headersTypeLint]; | ||
|
|
||
| export default lints; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| import messageBinding0_0_1Lints from './0-0-1/index.ts'; | ||
| import messageBinding0_1_0Lints from './0-1-0/index.ts'; | ||
| import messageBindingLatestLints from './latest/index.ts'; | ||
| import bindingVersionTypeLint from './binding-version--type.ts'; | ||
|
|
||
| const lints = [...messageBinding0_0_1Lints, ...messageBindingLatestLints, bindingVersionTypeLint]; | ||
| const lints = [ | ||
| ...messageBinding0_0_1Lints, | ||
| ...messageBinding0_1_0Lints, | ||
| ...messageBindingLatestLints, | ||
| bindingVersionTypeLint, | ||
| ]; | ||
|
|
||
| export default lints; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be stricter with this rule since the description says?
The type of destination, which MUST be either exchange or queue or fifo-queue