Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const completion: ApidomCompletionItem[] = [
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: 'Defines what type of channel is it. Can be either `queue` or `routingKey` (default).',
value:
'`string`\n\\\n\\\nDefines what type of channel is it. Can be either `queue` or `routingKey` (default).',
},
conditions: [
{
Expand All @@ -34,7 +35,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[string, any]`\n\\\n\\\nWhen `is=routingKey`, this object defines the exchange properties.',
'`Map[string, any]`\n\\\n\\\nWhen `is=routingKey`, this object defines the exchange properties.',
},
conditions: [
{
Expand All @@ -54,7 +55,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[string, any]`\n\\\n\\\nWhen `is=queue`, this object defines the queue properties.',
'`Map[string, any]`\n\\\n\\\nWhen `is=queue`, this object defines the queue properties.',
},
conditions: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const completion: ApidomCompletionItem[] = [
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: 'Defines what type of channel is it. Can be either `queue` or `routingKey` (default).',
value:
'`string`\n\\\n\\\nDefines what type of channel is it. Can be either `queue` or `routingKey` (default).',
},
conditions: [
{
Expand All @@ -34,7 +35,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[string, any]`\n\\\n\\\nWhen `is=routingKey`, this object defines the exchange properties.',
'`Map[string, any]`\n\\\n\\\nWhen `is=routingKey`, this object defines the exchange properties.',
},
conditions: [
{
Expand All @@ -54,7 +55,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[string, any]`\n\\\n\\\nWhen `is=queue`, this object defines the queue properties.',
'`Map[string, any]`\n\\\n\\\nWhen `is=queue`, this object defines the queue properties.',
},
conditions: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import {
ApidomCompletionItem,
CompletionFormat,
CompletionType,
} from '../../../../../../apidom-language-types.ts';

const completion: ApidomCompletionItem[] = [
{
label: 'is',
insertText: 'is',
kind: 14,
format: CompletionFormat.QUOTED,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'`string`\n\\\n\\\nDefines what type of channel is it. Can be either `queue` or `routingKey` (default).',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
},
{
label: 'exchange',
insertText: 'exchange',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'`Map[string, any]`\n\\\n\\\nWhen `is=routingKey`, this object defines the exchange properties.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
},
{
label: 'queue',
insertText: 'queue',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'`Map[string, any]`\n\\\n\\\nWhen `is=queue`, this object defines the queue properties.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
},
{
target: 'is',
label: 'queue',
insertText: 'queue',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
},
{
target: 'is',
label: 'routingKey',
insertText: 'routingKey',
kind: 12,
format: CompletionFormat.QUOTED,
type: CompletionType.VALUE,
insertTextFormat: 2,
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
},
];

export default completion;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import completion0_1_0Items from './0-1-0.ts';
import completion0_2_0Items from './0-2-0.ts';
import completion0_3_0Items from './0-3-0.ts';
import completionLatestItems from './latest.ts';
import {
ApidomCompletionItem,
Expand All @@ -10,6 +11,7 @@ import {
const completion: ApidomCompletionItem[] = [
...completion0_1_0Items,
...completion0_2_0Items,
...completion0_3_0Items,
...completionLatestItems,
{
label: 'bindingVersion',
Expand All @@ -20,7 +22,7 @@ const completion: ApidomCompletionItem[] = [
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: 'The version of this binding. If omitted, "0.2.0" MUST be assumed.',
value: '`string`\n\\\n\\\nThe version of this binding. If omitted, "0.3.0" MUST be assumed.',
},
},
{
Expand All @@ -41,6 +43,15 @@ const completion: ApidomCompletionItem[] = [
type: CompletionType.VALUE,
insertTextFormat: 2,
},
{
target: 'bindingVersion',
label: '0.3.0',
insertText: '0.3.0',
kind: 12,
format: CompletionFormat.QUOTED_FORCED,
type: CompletionType.VALUE,
insertTextFormat: 2,
},
];

export default completion;
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const completion: ApidomCompletionItem[] = [
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: 'Defines what type of channel is it. Can be either `queue` or `routingKey` (default).',
value:
'`string`\n\\\n\\\nDefines what type of channel is it. Can be either `queue` or `routingKey` (default).',
},
conditions: [
{
Expand All @@ -33,7 +34,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[string, any]`\n\\\n\\\nWhen `is=routingKey`, this object defines the exchange properties.',
'`Map[string, any]`\n\\\n\\\nWhen `is=routingKey`, this object defines the exchange properties.',
},
conditions: [
{
Expand All @@ -52,7 +53,7 @@ const completion: ApidomCompletionItem[] = [
documentation: {
kind: 'markdown',
value:
'Map[string, any]`\n\\\n\\\nWhen `is=queue`, this object defines the queue properties.',
'`Map[string, any]`\n\\\n\\\nWhen `is=queue`, this object defines the queue properties.',
},
conditions: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { AsyncAPI2, AsyncAPI3 } from '../../../target-specs.ts';

const documentation = [
{
target: 'is',
docs: 'Defines what type of channel is it. Can be either `queue` or `routingKey` (default).',
docs: '`string`\n\\\n\\\nDefines what type of channel is it. Can be either `queue` or `routingKey` (default).',
},
{
target: 'exchange',
Expand All @@ -13,10 +15,15 @@ const documentation = [
},
{
target: 'bindingVersion',
docs: 'The version of this binding. If omitted, "0.3.0" MUST be assumed.',
docs: '`string`\n\\\n\\\nThe version of this binding. If omitted, "0.3.0" MUST be assumed.',
},
{
docs: '#### [Channel Binding Object](https://github.com/asyncapi/bindings/tree/master/amqp#channel)\n\nThis object contains information about the channel representation in AMQP.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\n`is` | string | Defines what type of channel is it. Can be either `queue` or `routingKey` (default).\n`exchange` | Map[string, any] | When `is`=`routingKey`, this object defines the exchange properties.\n`exchange.name` | string | The name of the exchange. It MUST NOT exceed 255 characters long.\n`exchange.type` | string | The type of the exchange. Can be either `topic`, `direct`, `fanout`, `default` or `headers`.\n`exchange.durable` | boolean | Whether the exchange should survive broker restarts or not.\n`exchange.autoDelete` | boolean | Whether the exchange should be deleted when the last queue is unbound from it.\n`exchange.vhost` | string | The virtual host of the exchange. Defaults to `/`.\n`queue` | Map[string, any] | When `is`=`queue`, this object defines the queue properties.\n`queue.name` | string | The name of the queue. It MUST NOT exceed 255 characters long.\n`queue.durable` | boolean | Whether the queue should survive broker restarts or not.\n`queue.exclusive` | boolean | Whether the queue should be used only by one connection or not.\n`queue.autoDelete` | boolean | Whether the queue should be deleted when the last consumer unsubscribes.\n`queue.vhost` | string | The virtual host of the queue. Defaults to `/`.\n`bindingVersion` | string | The version of this binding. If omitted, "0.2.0" MUST be assumed.\n\nThis object MUST contain only the properties defined above.\n\n##### Example\n\n\n\\\nYAML\n```yaml\nchannels:\n user/signedup:\n bindings:\n amqp:\n is: routingKey\n queue:\n name: my-queue-name\n durable: true\n exclusive: true\n autoDelete: false\n vhost: /\n exchange:\n name: myExchange\n type: topic\n durable: true\n autoDelete: false\n vhost: /\n bindingVersion: 0.2.0\n```',
docs: '#### [Channel Binding Object](https://github.com/asyncapi/bindings/tree/master/amqp#channel)\n\nThis object contains information about the channel representation in AMQP.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\n`is` | string | Defines what type of channel is it. Can be either `queue` or `routingKey` (default).\n`exchange` | Map[string, any] | When `is`=`routingKey`, this object defines the exchange properties.\n`exchange.name` | string | The name of the exchange. It MUST NOT exceed 255 characters long.\n`exchange.type` | string | The type of the exchange. Can be either `topic`, `direct`, `fanout`, `default` or `headers`.\n`exchange.durable` | boolean | Whether the exchange should survive broker restarts or not.\n`exchange.autoDelete` | boolean | Whether the exchange should be deleted when the last queue is unbound from it.\n`exchange.vhost` | string | The virtual host of the exchange. Defaults to `/`.\n`queue` | Map[string, any] | When `is`=`queue`, this object defines the queue properties.\n`queue.name` | string | The name of the queue. It MUST NOT exceed 255 characters long.\n`queue.durable` | boolean | Whether the queue should survive broker restarts or not.\n`queue.exclusive` | boolean | Whether the queue should be used only by one connection or not.\n`queue.autoDelete` | boolean | Whether the queue should be deleted when the last consumer unsubscribes.\n`queue.vhost` | string | The virtual host of the queue. Defaults to `/`.\n`bindingVersion` | string | The version of this binding. If omitted, "0.3.0" MUST be assumed.\n\nThis object MUST contain only the properties defined above.\n\n##### Example\n\n\n\\\nYAML\n```yaml\nchannels:\n user/signedup:\n bindings:\n amqp:\n is: routingKey\n queue:\n name: my-queue-name\n durable: true\n exclusive: true\n autoDelete: false\n vhost: /\n exchange:\n name: myExchange\n type: topic\n durable: true\n autoDelete: false\n vhost: /\n bindingVersion: 0.3.0\n```',
targetSpecs: AsyncAPI2,
},
{
docs: '#### [Channel Binding Object](https://github.com/asyncapi/bindings/tree/master/amqp#channel)\n\nThis object contains information about the channel representation in AMQP.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\n`is` | string | Defines what type of channel is it. Can be either `queue` or `routingKey` (default).\n`exchange` | Map[string, any] | When `is`=`routingKey`, this object defines the exchange properties.\n`exchange.name` | string | The name of the exchange. It MUST NOT exceed 255 characters long.\n`exchange.type` | string | The type of the exchange. Can be either `topic`, `direct`, `fanout`, `default` or `headers`.\n`exchange.durable` | boolean | Whether the exchange should survive broker restarts or not.\n`exchange.autoDelete` | boolean | Whether the exchange should be deleted when the last queue is unbound from it.\n`exchange.vhost` | string | The virtual host of the exchange. Defaults to `/`.\n`queue` | Map[string, any] | When `is`=`queue`, this object defines the queue properties.\n`queue.name` | string | The name of the queue. It MUST NOT exceed 255 characters long.\n`queue.durable` | boolean | Whether the queue should survive broker restarts or not.\n`queue.exclusive` | boolean | Whether the queue should be used only by one connection or not.\n`queue.autoDelete` | boolean | Whether the queue should be deleted when the last consumer unsubscribes.\n`queue.vhost` | string | The virtual host of the queue. Defaults to `/`.\n`bindingVersion` | string | The version of this binding. If omitted, "0.3.0" MUST be assumed.\n\nThis object MUST contain only the properties defined above.\n\n##### Example\n\n\n\\\nYAML\n```yaml\nchannels:\n userSignup:\n address: \'user/signup\'\n bindings:\n amqp:\n is: routingKey\n exchange:\n name: myExchange\n type: topic\n durable: true\n autoDelete: false\n vhost: /\n bindingVersion: 0.3.0\n```',
targetSpecs: AsyncAPI3,
},
];
export default documentation;
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: [['is', 'exchange', 'queue', 'bindingVersion']],
marker: 'key',
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.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 exchangeTypeLint: LinterMeta = {
code: ApilintCodes.ASYNCAPI2_AMQP_CHANNEL_BINDING_FIELD_EXCHANGE_TYPE,
source: 'apilint',
message: "'exchange' value must be an object",
severity: DiagnosticSeverity.Error,
linterFunction: 'apilintType',
linterParams: ['object'],
marker: 'value',
target: 'exchange',
data: {},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
};

export default exchangeTypeLint;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import allowedFieldsLint from './allowed-fields.ts';
import exchangeTypeLint from './exchange--type.ts';
import isEqualsLint from './is--equals.ts';
import queueTypeLint from './queue--type.ts';

const lints = [exchangeTypeLint, isEqualsLint, queueTypeLint, allowedFieldsLint];

export default lints;
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 isEqualsLint: LinterMeta = {
code: ApilintCodes.ASYNCAPI2_AMQP_CHANNEL_BINDING_FIELD_IS_EQUALS,
source: 'apilint',
message: "'is' must be one of allowed values",
severity: DiagnosticSeverity.Error,
linterFunction: 'apilintValueOrArray',
linterParams: [['queue', 'routingKey']],
marker: 'value',
target: 'is',
data: {},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
};

export default isEqualsLint;
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 queueTypeLint: LinterMeta = {
code: ApilintCodes.ASYNCAPI2_AMQP_CHANNEL_BINDING_FIELD_QUEUE_TYPE,
source: 'apilint',
message: "'queue' value must be an object",
severity: DiagnosticSeverity.Error,
linterFunction: 'apilintType',
linterParams: ['object'],
marker: 'value',
target: 'queue',
data: {},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
};

export default queueTypeLint;
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import channelBinding0_1_0Lints from './0-1-0/index.ts';
import channelBinding0_2_0Lints from './0-2-0/index.ts';
import channelBinding0_3_0Lints from './0-3-0/index.ts';
import channelBindingLatestLints from './latest/index.ts';
import bindingVersionTypeLint from './binding-version--type.ts';

const lints = [
...channelBinding0_1_0Lints,
...channelBinding0_2_0Lints,
...channelBinding0_3_0Lints,
...channelBindingLatestLints,
bindingVersionTypeLint,
];
Expand Down
Loading
Loading