Skip to content
Open
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,7 @@ const completion: ApidomCompletionItem[] = [
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: 'Kafka topic name if different from channel name.',
value: '`string`\n\\\n\\\nKafka topic name if different from channel name.',
},
conditions: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import {
ApidomCompletionItem,
CompletionFormat,
CompletionType,
} from '../../../../../../apidom-language-types.ts';

const completion: ApidomCompletionItem[] = [
{
label: 'topic',
insertText: 'topic',
kind: 14,
format: CompletionFormat.QUOTED,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: '`string`\n\\\n\\\nKafka topic name if different from channel name.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.4.0']],
},
],
},
{
label: 'partitions',
insertText: 'partitions',
kind: 14,
format: CompletionFormat.UNQUOTED,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'`integer`\n\\\n\\\nNumber of partitions configured on this topic (useful to know how many parallel consumers you may run).',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.4.0']],
},
],
},
{
label: 'replicas',
insertText: 'replicas',
kind: 14,
format: CompletionFormat.UNQUOTED,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: '`integer`\n\\\n\\\nNumber of replicas configured on this topic.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.4.0']],
},
],
},
{
label: 'topicConfiguration',
insertText: 'topicConfiguration',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Topic Configuration Object](https://github.com/asyncapi/bindings/blob/306f1fc8333e10730a6dd953e92211f0cdb7736e/kafka/README.md#topicConfiguration-object)\n\\\n\\\nTopic configuration properties that are relevant for the API.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.4.0']],
},
],
},
];

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

const completion: ApidomCompletionItem[] = [
{
label: 'topic',
insertText: 'topic',
kind: 14,
format: CompletionFormat.QUOTED,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: '`string`\n\\\n\\\nKafka topic name if different from channel name.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.5.0']],
},
],
},
{
label: 'partitions',
insertText: 'partitions',
kind: 14,
format: CompletionFormat.UNQUOTED,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'`integer`\n\\\n\\\nNumber of partitions configured on this topic (useful to know how many parallel consumers you may run).',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.5.0']],
},
],
},
{
label: 'replicas',
insertText: 'replicas',
kind: 14,
format: CompletionFormat.UNQUOTED,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: '`integer`\n\\\n\\\nNumber of replicas configured on this topic.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.5.0']],
},
],
},
{
label: 'topicConfiguration',
insertText: 'topicConfiguration',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Topic Configuration Object](https://github.com/asyncapi/bindings/blob/master/kafka/README.md#topicConfiguration-object)\n\\\n\\\nTopic configuration properties that are relevant for the API.',
},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.5.0']],
},
],
},
];

export default completion;
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import completion0_3_0Items from './0-3-0.ts';
import completion0_4_0Items from './0-4-0.ts';
import completion0_5_0Items from './0-5-0.ts';
import completionLatestItems from './latest.ts';
import {
ApidomCompletionItem,
Expand All @@ -8,6 +10,8 @@ import {

const completion: ApidomCompletionItem[] = [
...completion0_3_0Items,
...completion0_4_0Items,
...completion0_5_0Items,
...completionLatestItems,
{
label: 'bindingVersion',
Expand All @@ -18,7 +22,7 @@ const completion: ApidomCompletionItem[] = [
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: 'The version of this binding. If omitted, "0.3.0" MUST be assumed.',
value: '`string`\n\\\n\\\nThe version of this binding. If omitted, "0.5.0" MUST be assumed.',
},
},
{
Expand Down Expand Up @@ -48,6 +52,24 @@ const completion: ApidomCompletionItem[] = [
type: CompletionType.VALUE,
insertTextFormat: 2,
},
{
target: 'bindingVersion',
label: '0.4.0',
insertText: '0.4.0',
kind: 12,
format: CompletionFormat.QUOTED_FORCED,
type: CompletionType.VALUE,
insertTextFormat: 2,
},
{
target: 'bindingVersion',
label: '0.5.0',
insertText: '0.5.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,7 @@ const completion: ApidomCompletionItem[] = [
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value: 'Kafka topic name if different from channel name.',
value: '`string`\n\\\n\\\nKafka topic name if different from channel name.',
},
conditions: [
{
Expand Down Expand Up @@ -60,6 +60,25 @@ const completion: ApidomCompletionItem[] = [
},
],
},
{
label: 'topicConfiguration',
insertText: 'topicConfiguration',
kind: 14,
format: CompletionFormat.OBJECT,
type: CompletionType.PROPERTY,
insertTextFormat: 2,
documentation: {
kind: 'markdown',
value:
'[Topic Configuration Object](https://github.com/asyncapi/bindings/blob/master/kafka/README.md#topicConfiguration-object)\n\\\n\\\nTopic configuration properties that are relevant for the API.',
},
conditions: [
{
function: 'missingField',
params: ['bindingVersion'],
},
],
},
];

export default completion;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const documentation = [
{
target: 'topic',
docs: 'Kafka topic name if different from channel name.',
docs: '`string`\n\\\n\\\nKafka topic name if different from channel name.',
},
{
target: 'partitions',
Expand All @@ -11,12 +11,16 @@ const documentation = [
target: 'replicas',
docs: '`integer`\n\\\n\\\nNumber of replicas configured on this topic.',
},
{
target: 'topicConfiguration',
docs: '[Topic Configuration Object](https://github.com/asyncapi/bindings/blob/master/kafka/README.md#topicConfiguration-object)\n\\\n\\\nTopic configuration properties that are relevant for the API.\n\n##### Fixed Fields\n\nField Name | Type | Description | Applicability [default] | Constraints\n---|:---:|:---:|:---:|---\n`cleanup.policy` | array | The [`cleanup.policy`](https://kafka.apache.org/documentation/#topicconfigs_cleanup.policy) configuration option. | OPTIONAL | array may only contain `delete` and/or `compact`\n`retention.ms` | long | The [`retention.ms`](https://kafka.apache.org/documentation/#topicconfigs_retention.ms) configuration option. | OPTIONAL | see kafka documentation\n`retention.bytes` | long | The [`retention.bytes`](https://kafka.apache.org/documentation/#topicconfigs_retention.bytes) configuration option. | OPTIONAL | see kafka documentation\n`delete.retention.ms` | long | The [`delete.retention.ms`](https://kafka.apache.org/documentation/#topicconfigs_delete.retention.ms) configuration option. | OPTIONAL | see kafka documentation\n`max.message.bytes` | integer | The [`max.message.bytes`](https://kafka.apache.org/documentation/#topicconfigs_max.message.bytes) configuration option. | OPTIONAL | see kafka documentation\n`confluent.key.schema.validation` | boolean | It shows whether the schema validation for the message key is enabled. Vendor specific config. | OPTIONAL | -\n`confluent.key.subject.name.strategy` | string | The name of the schema lookup strategy for the message key. Vendor specific config. | OPTIONAL | Clients should default to the vendor default if not supplied.\n`confluent.value.schema.validation` | boolean | It shows whether the schema validation for the message value is enabled. Vendor specific config. | OPTIONAL | -\n`confluent.value.subject.name.strategy` | string | The name of the schema lookup strategy for the message value. Vendor specific config. | OPTIONAL | Clients should default to the vendor default if not supplied.',
},
{
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.5.0" MUST be assumed.',
},
{
docs: "#### [Channel Binding Object](https://github.com/asyncapi/bindings/blob/master/kafka#channel)\n\nThis object contains information about the channel representation in Kafka (eg. a Kafka topic).\n\n##### Fixed Fields\n\nField Name | Type | Description | Applicability [default] | Constraints\n---|:---:|:---:|:---:|---\n`topic` | string | Kafka topic name if different from channel name. | OPTIONAL | -\n`partitions` | integer | Number of partitions configured on this topic (useful to know how many parallel consumers you may run). | OPTIONAL | Must be positive\n`replicas` | integer | Number of replicas configured on this topic. | OPTIONAL | MUST be positive\n`bindingVersion` | string | The version of this binding. If omitted, \"0.3.0\" MUST be assumed. | OPTIONAL [`0.3.0`] | -\n\nThis object MUST contain only the properties defined above.\n\n##### Example\n\nThis example is valid for any Confluent compatible schema registry. Here we describe the implementation using the first 4 bytes in payload to store schema identifier.\n\n\n\\\nYAML\n```yaml\nchannels:\n user-signedup:\n bindings:\n kafka:\n topic: 'my-specific-topic-name'\n partitions: 20\n replicas: 3\n bindingVersion: '0.3.0'\n```",
docs: "#### [Channel Binding Object](https://github.com/asyncapi/bindings/blob/master/kafka#channel)\n\nThis object contains information about the channel representation in Kafka (eg. a Kafka topic).\n\n##### Fixed Fields\n\nField Name | Type | Description | Applicability [default] | Constraints\n---|:---:|:---:|:---:|---\n`topic` | string | Kafka topic name if different from channel name. | OPTIONAL | -\n`partitions` | integer | Number of partitions configured on this topic (useful to know how many parallel consumers you may run). | OPTIONAL | Must be positive\n`replicas` | integer | Number of replicas configured on this topic. | OPTIONAL | MUST be positive\n`topicConfiguration` | [Topic Configuration Object](https://github.com/asyncapi/bindings/blob/master/kafka/README.md#topicConfiguration-object) | Topic configuration properties that are relevant for the API. | OPTIONAL | -\n`bindingVersion` | string | The version of this binding. If omitted, \"0.5.0\" MUST be assumed. | OPTIONAL [`0.5.0`] | -\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 kafka:\n topic: 'my-specific-topic-name'\n partitions: 20\n replicas: 3\n topicConfiguration:\n cleanup.policy: ['delete', 'compact']\n retention.ms: 604800000\n retention.bytes: 1000000000\n delete.retention.ms: 86400000\n max.message.bytes: 1048588\n bindingVersion: '0.5.0'\n```",
},
];
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: [['topic', 'partitions', 'replicas', 'topicConfiguration', 'bindingVersion']],
marker: 'key',
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.4.0']],
},
],
};

export default allowedFieldsLint;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import allowedFieldsLint from './allowed-fields.ts';
import topicTypeLint from './topic--type.ts';
import partitionsMinimumLint from './partitions--minimum.ts';
import replicasMinimumLint from './replicas--minimum.ts';
import topicConfigurationTypeLint from './topic-configuration--type.ts';

const lints = [
topicTypeLint,
partitionsMinimumLint,
replicasMinimumLint,
topicConfigurationTypeLint,
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 partitionsMinimumLint: LinterMeta = {
code: ApilintCodes.ASYNCAPI2_KAFKA_CHANNEL_BINDING_FIELD_PARTITIONS_MINIMUM,
source: 'apilint',
message: "'partitions' value must be positive integer",
severity: DiagnosticSeverity.Error,
linterFunction: 'apilintMinimum',
linterParams: [1],
marker: 'value',
target: 'partitions',
data: {},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.4.0']],
},
],
};

export default partitionsMinimumLint;
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 replicasMinimumLint: LinterMeta = {
code: ApilintCodes.ASYNCAPI2_KAFKA_CHANNEL_BINDING_FIELD_REPLICAS_MINIMUM,
source: 'apilint',
message: "'replicas' value must be positive integer",
severity: DiagnosticSeverity.Error,
linterFunction: 'apilintMinimum',
linterParams: [1],
marker: 'value',
target: 'replicas',
data: {},
conditions: [
{
targets: [{ path: 'bindingVersion' }],
function: 'apilintValueOrArray',
params: [['0.4.0']],
},
],
};

export default replicasMinimumLint;
Loading
Loading