Skip to content

Commit

Permalink
feat: add new kafka topic configuration properties (asyncapi#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
gokerakc authored Feb 21, 2024
1 parent a444ea4 commit ae96600
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 0 deletions.
96 changes: 96 additions & 0 deletions bindings/kafka/0.5.0/channel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/bindings/kafka/0.5.0/channel.json",
"title": "Channel Schema",
"description": "This object contains information about the channel representation in Kafka.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"properties": {
"topic": {
"type": "string",
"description": "Kafka topic name if different from channel name."
},
"partitions": {
"type": "integer",
"minimum": 1,
"description": "Number of partitions configured on this topic."
},
"replicas": {
"type": "integer",
"minimum": 1,
"description": "Number of replicas configured on this topic."
},
"topicConfiguration" : {
"description": "Topic configuration properties that are relevant for the API.",
"type": "object",
"additionalProperties": true,
"properties": {
"cleanup.policy": {
"description": "The [`cleanup.policy`](https://kafka.apache.org/documentation/#topicconfigs_cleanup.policy) configuration option.",
"type": "array",
"items":{
"type": "string",
"enum": ["compact", "delete"]
}
},
"retention.ms": {
"description": "The [`retention.ms`](https://kafka.apache.org/documentation/#topicconfigs_retention.ms) configuration option.",
"type": "integer",
"minimum": -1
},
"retention.bytes": {
"description": "The [`retention.bytes`](https://kafka.apache.org/documentation/#topicconfigs_retention.bytes) configuration option.",
"type": "integer",
"minimum": -1
},
"delete.retention.ms": {
"description": "The [`delete.retention.ms`](https://kafka.apache.org/documentation/#topicconfigs_delete.retention.ms) configuration option.",
"type": "integer",
"minimum": 0
},
"max.message.bytes": {
"description": "The [`max.message.bytes`](https://kafka.apache.org/documentation/#topicconfigs_max.message.bytes) configuration option.",
"type": "integer",
"minimum": 0
},
"confluent.key.schema.validation": {
"description": "It shows whether the schema validation for the message key is enabled. Vendor specific config. For more details: (https://docs.confluent.io/platform/current/installation/configuration/topic-configs.html#confluent-key-schema-validation)",
"type": "boolean"
},
"confluent.key.subject.name.strategy": {
"description": "The name of the schema lookup strategy for the message key. Vendor specific config. For more details: (https://docs.confluent.io/platform/current/installation/configuration/topic-configs.html#confluent-key-subject-name-strategy)",
"type": "string"
},
"confluent.value.schema.validation": {
"description": "It shows whether the schema validation for the message value is enabled. Vendor specific config. For more details: (https://docs.confluent.io/platform/current/installation/configuration/topic-configs.html#confluent-value-schema-validation)",
"type": "boolean"
},
"confluent.value.subject.name.strategy": {
"description": "The name of the schema lookup strategy for the message value. Vendor specific config. For more details: (https://docs.confluent.io/platform/current/installation/configuration/topic-configs.html#confluent-value-subject-name-strategy)",
"type": "string"
}
}
},
"bindingVersion": {
"type": "string",
"enum": [
"0.5.0"
],
"description": "The version of this binding. If omitted, 'latest' MUST be assumed."
}

},
"examples": [
{
"topic": "my-specific-topic",
"partitions": 20,
"replicas": 3,
"bindingVersion": "0.5.0"
}
]
}
68 changes: 68 additions & 0 deletions bindings/kafka/0.5.0/message.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/bindings/kafka/0.5.0/message.json",
"title": "Message Schema",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"properties": {
"key": {
"oneOf": [
{
"$ref": "http://asyncapi.com/definitions/3.0.0/Reference.json"
},
{
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json"
}
],
"description": "The message key."
},
"schemaIdLocation": {
"type": "string",
"description": "If a Schema Registry is used when performing this operation, tells where the id of schema is stored.",
"enum": ["header", "payload"]
},
"schemaIdPayloadEncoding": {
"type": "string",
"description": "Number of bytes or vendor specific values when schema id is encoded in payload."
},
"schemaLookupStrategy": {
"type": "string",
"description": "Freeform string for any naming strategy class to use. Clients should default to the vendor default if not supplied."
},
"bindingVersion": {
"type": "string",
"enum": [
"0.5.0"
],
"description": "The version of this binding. If omitted, 'latest' MUST be assumed."
}

},
"examples": [
{
"key": {
"type": "string",
"enum": [
"myKey"
]
},
"schemaIdLocation": "payload",
"schemaIdPayloadEncoding": "apicurio-new",
"schemaLookupStrategy": "TopicIdStrategy",
"bindingVersion": "0.5.0"
},
{
"key": {
"$ref": "path/to/user-create.avsc#/UserCreate"
},
"schemaIdLocation": "payload",
"schemaIdPayloadEncoding": "4",
"bindingVersion": "0.5.0"
}
]
}
47 changes: 47 additions & 0 deletions bindings/kafka/0.5.0/operation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/bindings/kafka/0.5.0/operation.json",
"title": "Operation Schema",
"description": "This object contains information about the operation representation in Kafka.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"properties": {
"groupId": {
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json",
"description": "Id of the consumer group."
},
"clientId": {
"$ref": "http://asyncapi.com/definitions/3.0.0/schema.json",
"description": "Id of the consumer inside a consumer group."
},
"bindingVersion": {
"type": "string",
"enum": [
"0.5.0"
],
"description": "The version of this binding. If omitted, 'latest' MUST be assumed."
}
},
"examples": [
{
"groupId": {
"type": "string",
"enum": [
"myGroupId"
]
},
"clientId": {
"type": "string",
"enum": [
"myClientId"
]
},
"bindingVersion": "0.5.0"
}
]
}
37 changes: 37 additions & 0 deletions bindings/kafka/0.5.0/server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://asyncapi.com/bindings/kafka/0.5.0/server.json",
"title": "Server Schema",
"description": "This object contains server connection information to a Kafka broker. This object contains additional information not possible to represent within the core AsyncAPI specification.",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^x-[\\w\\d\\.\\x2d_]+$": {
"$ref": "http://asyncapi.com/definitions/3.0.0/specificationExtension.json"
}
},
"properties": {
"schemaRegistryUrl": {
"type": "string",
"description": "API URL for the Schema Registry used when producing Kafka messages (if a Schema Registry was used)."
},
"schemaRegistryVendor": {
"type": "string",
"description": "The vendor of the Schema Registry and Kafka serdes library that should be used."
},
"bindingVersion": {
"type": "string",
"enum": [
"0.5.0"
],
"description": "The version of this binding."
}
},
"examples": [
{
"schemaRegistryUrl": "https://my-schema-registry.com",
"schemaRegistryVendor": "confluent",
"bindingVersion": "0.5.0"
}
]
}

0 comments on commit ae96600

Please sign in to comment.