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
@@ -0,0 +1,50 @@
import {
ApidomCompletionItem,
CompletionFormat,
CompletionType,
} from '../../../../../../apidom-language-types.ts';

const completion: ApidomCompletionItem[] = [
{
label: 'queue',
insertText: 'queue',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Queue](https://github.com/asyncapi/bindings/blob/85b00377193b8ffd3c8f565db25981bbd2e4dde9/sqs/README.md#queue)\n\\\n\\\n**Required.** A definition of the queue that will be used as the channel.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.1.0']],
},
],
},
{
label: 'deadLetterQueue',
insertText: 'deadLetterQueue',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Queue](https://github.com/asyncapi/bindings/blob/85b00377193b8ffd3c8f565db25981bbd2e4dde9/sqs/README.md#queue)\n\\\n\\\n**Optional.** A definition of the queue that will be used for un-processable messages.',
},
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,50 @@
import {
ApidomCompletionItem,
CompletionFormat,
CompletionType,
} from '../../../../../../apidom-language-types.ts';

const completion: ApidomCompletionItem[] = [
{
label: 'queue',
insertText: 'queue',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Queue](https://github.com/asyncapi/bindings/blob/e14c6782a95aaa009d33b9a6b72194cbaebd39ff/sqs/README.md#queue)\n\\\n\\\n**Required.** A definition of the queue that will be used as the channel.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.2.0']],
},
],
},
{
label: 'deadLetterQueue',
insertText: 'deadLetterQueue',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Queue](https://github.com/asyncapi/bindings/blob/e14c6782a95aaa009d33b9a6b72194cbaebd39ff/sqs/README.md#queue)\n\\\n\\\n**Optional.** A definition of the queue that will be used for un-processable messages.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.2.0']],
},
],
},
];

export default completion;
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {
ApidomCompletionItem,
CompletionFormat,
CompletionType,
} from '../../../../../../apidom-language-types.ts';

const completion: ApidomCompletionItem[] = [
{
label: 'queue',
insertText: 'queue',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Queue](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#queue)\n\\\n\\\n**Required.** A definition of the queue that will be used as the channel.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
},
{
label: 'deadLetterQueue',
insertText: 'deadLetterQueue',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Queue](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#queue)\n\\\n\\\n**Optional.** A definition of the queue that will be used for un-processable messages.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.3.0']],
},
],
},
];

export default completion;
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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,
CompletionFormat,
CompletionType,
} from '../../../../../../apidom-language-types.ts';

const completion: ApidomCompletionItem[] = [
...completion0_1_0Items,
...completion0_2_0Items,
...completion0_3_0Items,
...completionLatestItems,
{
label: 'bindingVersion',
insertText: 'bindingVersion',
kind: 14,
format: CompletionFormat.QUOTED,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: '**Optional**, defaults to `latest`. The version of this binding.',
},
},
{
target: 'bindingVersion',
label: '0.1.0',
insertText: '0.1.0',
kind: 12,
format: CompletionFormat.QUOTED_FORCED,
type: CompletionType.VALUE,
insertTextFormat: 2,
},
{
target: 'bindingVersion',
label: '0.2.0',
insertText: '0.2.0',
kind: 12,
format: CompletionFormat.QUOTED_FORCED,
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
@@ -0,0 +1,48 @@
import {
ApidomCompletionItem,
CompletionFormat,
CompletionType,
} from '../../../../../../apidom-language-types.ts';

const completion: ApidomCompletionItem[] = [
{
label: 'queue',
insertText: 'queue',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Queue](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#queue)\n\\\n\\\n**Required.** A definition of the queue that will be used as the channel.',
},
conditions: [
{
function: 'missingField',
params: ['bindingVersion'],
},
],
},
{
label: 'deadLetterQueue',
insertText: 'deadLetterQueue',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Queue](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#queue)\n\\\n\\\n**Optional.** A definition of the queue that will be used for un-processable messages.',
},
conditions: [
{
function: 'missingField',
params: ['bindingVersion'],
},
],
},
];

export default completion;
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
const documentation = [
{
docs: '#### [Channel Binding Object](https://github.com/asyncapi/bindings/blob/master/sqs#channel)\n\nThis object MUST NOT contain any properties. Its name is reserved for future use.',
target: 'queue',
docs: '[Queue](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#queue)\n\\\n\\\n**Required.** A definition of the queue that will be used as the channel.\n\nField Name | Type | Description\n---|:---:|---\n`name` | string | **Required.** The name of the queue. When an SNS Operation Binding Object references an SQS queue by name, the identifier should be the one in this field.\n`fifoQueue` | boolean | **Required.** Is this a FIFO queue?\n`deduplicationScope` | string | **Optional.** Specifies whether message deduplication occurs at the message group or queue level. Valid values are `messageGroup` and `queue`. This property applies only to high throughput for FIFO queues.\n`fifoThroughputLimit` | string | **Optional.** Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are `perQueue` and `perMessageGroupId`. The `perMessageGroupId` value is allowed only when the value for DeduplicationScope is `messageGroup`. This property applies only to high throughput for FIFO queues.\n`deliveryDelay` | integer | **Optional.** The number of seconds to delay before a message sent to the queue can be received. Used to create a delay queue. Range is 0 to 15 minutes. Defaults to 0.\n`visibilityTimeout` | integer | **Optional.** The length of time, in seconds, that a consumer locks a message - hiding it from reads - before it is unlocked and can be read again. Range from 0 to 12 hours (43200 seconds). Defaults to 30 seconds.\n`receiveMessageWaitTime` | integer | **Optional.** Determines if the queue uses [short polling](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html) or [long polling](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html). Set to zero (the default) the queue reads available messages and returns immediately. Set to a non-zero integer, long polling waits the specified number of seconds for messages to arrive before returning.\n`messageRetentionPeriod` | integer | **Optional.** How long to retain a message on the queue in seconds, unless deleted. The range is 60 (1 minute) to 1,209,600 (14 days). The default is 345,600 (4 days).\n`redrivePolicy` | [Redrive Policy](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#redrive-policy) | **Optional.** Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue.\n`policy` | [Policy](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#policy) | **Optional.** The security policy for the SQS Queue.\n`tags` | object | **Optional.** Key-value pairs that represent AWS tags on the queue.',
},
{
target: 'deadLetterQueue',
docs: '[Queue](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#queue)\n\\\n\\\n**Optional.** A definition of the queue that will be used for un-processable messages.\n\nField Name | Type | Description\n---|:---:|---\n`name` | string | **Required.** The name of the queue. When an SNS Operation Binding Object references an SQS queue by name, the identifier should be the one in this field.\n`fifoQueue` | boolean | **Required.** Is this a FIFO queue?\n`deduplicationScope` | string | **Optional.** Specifies whether message deduplication occurs at the message group or queue level. Valid values are `messageGroup` and `queue`. This property applies only to high throughput for FIFO queues.\n`fifoThroughputLimit` | string | **Optional.** Specifies whether the FIFO queue throughput quota applies to the entire queue or per message group. Valid values are `perQueue` and `perMessageGroupId`. The `perMessageGroupId` value is allowed only when the value for DeduplicationScope is `messageGroup`. This property applies only to high throughput for FIFO queues.\n`deliveryDelay` | integer | **Optional.** The number of seconds to delay before a message sent to the queue can be received. Used to create a delay queue. Range is 0 to 15 minutes. Defaults to 0.\n`visibilityTimeout` | integer | **Optional.** The length of time, in seconds, that a consumer locks a message - hiding it from reads - before it is unlocked and can be read again. Range from 0 to 12 hours (43200 seconds). Defaults to 30 seconds.\n`receiveMessageWaitTime` | integer | **Optional.** Determines if the queue uses [short polling](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html) or [long polling](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-short-and-long-polling.html). Set to zero (the default) the queue reads available messages and returns immediately. Set to a non-zero integer, long polling waits the specified number of seconds for messages to arrive before returning.\n`messageRetentionPeriod` | integer | **Optional.** How long to retain a message on the queue in seconds, unless deleted. The range is 60 (1 minute) to 1,209,600 (14 days). The default is 345,600 (4 days).\n`redrivePolicy` | [Redrive Policy](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#redrive-policy) | **Optional.** Prevent poison pill messages by moving un-processable messages to an SQS dead letter queue.\n`policy` | [Policy](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#policy) | **Optional.** The security policy for the SQS Queue.\n`tags` | object | **Optional.** Key-value pairs that represent AWS tags on the queue.',
},
{
target: 'bindingVersion',
docs: '`string`\n\\\n\\\n**Optional**, defaults to `latest`. The version of this binding.',
},
{
docs: '#### [Channel Binding Object](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#channel-binding-object)\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nqueue | [Queue](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#queue) | **Required**. A definition of the queue that will be used as the channel.\ndeadLetterQueue | [Queue](https://github.com/asyncapi/bindings/blob/master/sqs/README.md#queue) | **Optional**. A definition of the queue that will be used for un-processable messages.\nbindingVersion | string | **Optional**, defaults to `latest`. The version of this binding.',
},
];
export default documentation;
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { LinterMeta } from '../../../../../../../apidom-language-types.ts';
const allowedFieldsLint: LinterMeta = {
code: ApilintCodes.NOT_ALLOWED_FIELDS,
source: 'apilint',
message: 'This object MUST NOT contain any properties. Its name is reserved for future use.',
message: 'Object includes not allowed fields.',
severity: DiagnosticSeverity.Error,
linterFunction: 'allowedFields',
linterParams: [[]],
linterParams: [['queue', 'deadLetterQueue', 'bindingVersion']],
marker: 'key',
conditions: [
{
Expand Down
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 deadLetterQueueTypeLint: LinterMeta = {
code: ApilintCodes.ASYNCAPI2_SQS_CHANNEL_BINDING_FIELD_DEAD_LETTER_QUEUE_TYPE,
source: 'apilint',
message: "'deadLetterQueue' value must be an object",
severity: DiagnosticSeverity.Error,
linterFunction: 'apilintType',
linterParams: ['object'],
marker: 'value',
target: 'deadLetterQueue',
data: {},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.1.0']],
},
],
};

export default deadLetterQueueTypeLint;
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import allowedFieldsLint from './allowed-fields.ts';
import queueTypeLint from './queue--type.ts';
import deadLetterQueueTypeLint from './dead-letter-queue--type.ts';

const lints = [allowedFieldsLint];
const lints = [queueTypeLint, deadLetterQueueTypeLint, 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 queueTypeLint: LinterMeta = {
code: ApilintCodes.ASYNCAPI2_SQS_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.1.0']],
},
],
};

export default queueTypeLint;
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: [['queue', 'deadLetterQueue', 'bindingVersion']],
marker: 'key',
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.2.0']],
},
],
};

export default allowedFieldsLint;
Loading
Loading