From c3a15537f53d074c6ce4fdd5b8e906fa842de2b9 Mon Sep 17 00:00:00 2001 From: Paolo Patierno Date: Mon, 23 Dec 2024 13:22:33 +0100 Subject: [PATCH] Dropped support for OpenAPI v2 Swagger specification. (#959) * Dropped support for OpenAPI v2 Swagger specification. Signed-off-by: Paolo Patierno * Updated OpenAPI specification and documentation Signed-off-by: Paolo Patierno * Update generated documentation Signed-off-by: Paolo Patierno --------- Signed-off-by: Paolo Patierno --- CHANGELOG.md | 3 + .../openapi.json-generate-apidoc.sha256 | 2 +- documentation/book/api/index.adoc | 16 +- ...n-overview-open-api-spec-kafka-bridge.adoc | 2 +- .../strimzi/kafka/bridge/http/HttpBridge.java | 12 +- src/main/resources/openapi.json | 22 +- src/main/resources/openapiv2.json | 2105 ----------------- .../kafka/bridge/http/OtherServicesIT.java | 15 +- 8 files changed, 40 insertions(+), 2137 deletions(-) delete mode 100644 src/main/resources/openapiv2.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 2efa49d4..36bc2a6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ * Dependency updates (JMX exporter 1.1.0) * Dropped support for Java 11 and replaced with Java 17. +* Dropped support for OpenAPI v2 Swagger specification. + * The `/openapi/v2` endpoint returns HTTP 410 Gone. + * Both the `/openapi` and `/openapi/v3` endpoints return the OpenAPI v3 definition of the bridge REST API. ## 0.31.1 diff --git a/documentation/book/api/.openapi-generator/openapi.json-generate-apidoc.sha256 b/documentation/book/api/.openapi-generator/openapi.json-generate-apidoc.sha256 index f0bdd7ef..20d03507 100644 --- a/documentation/book/api/.openapi-generator/openapi.json-generate-apidoc.sha256 +++ b/documentation/book/api/.openapi-generator/openapi.json-generate-apidoc.sha256 @@ -1 +1 @@ -cf88d8909114896517ba4027596382126bca594d55dd9a924330232407e603b2 \ No newline at end of file +638e4ea2961241ead6552ccef364f2617c3b602e4bf9dff7786f5c463b07d063 \ No newline at end of file diff --git a/documentation/book/api/index.adoc b/documentation/book/api/index.adoc index af76517a..7c54138b 100644 --- a/documentation/book/api/index.adoc +++ b/documentation/book/api/index.adoc @@ -1432,7 +1432,7 @@ endif::internal-generation[] ===== Description -Retrieves the OpenAPI v2 specification in JSON format. +Retrieves the OpenAPI v3 specification in JSON format. // markup not found, no include::{specDir}openapi/GET/spec.adoc[opts=optional] @@ -1467,7 +1467,7 @@ Retrieves the OpenAPI v2 specification in JSON format. | 200 -| OpenAPI v2 specification in JSON format retrieved successfully. +| OpenAPI v3 specification in JSON format retrieved successfully. | <> |=== @@ -1503,7 +1503,7 @@ endif::internal-generation[] ===== Description -Retrieves the OpenAPI v2 specification in JSON format. +OpenAPI v2 Swagger not supported. // markup not found, no include::{specDir}openapi/v2/GET/spec.adoc[opts=optional] @@ -1522,12 +1522,12 @@ Retrieves the OpenAPI v2 specification in JSON format. -<> +- ===== Content Type -* application/json +* application/vnd.kafka.v2+json ===== Responses @@ -1537,9 +1537,9 @@ Retrieves the OpenAPI v2 specification in JSON format. | Code | Message | Datatype -| 200 -| OpenAPI v2 specification in JSON format retrieved successfully. -| <> +| 410 +| OpenAPI v2 Swagger not supported. +| <> |=== diff --git a/documentation/modules/con-overview-open-api-spec-kafka-bridge.adoc b/documentation/modules/con-overview-open-api-spec-kafka-bridge.adoc index c369f9a7..2130f7f7 100644 --- a/documentation/modules/con-overview-open-api-spec-kafka-bridge.adoc +++ b/documentation/modules/con-overview-open-api-spec-kafka-bridge.adoc @@ -13,7 +13,7 @@ The Kafka Bridge OpenAPI specification is in JSON format. You can find the OpenAPI JSON files in the `src/main/resources/` folder of the Kafka Bridge source download files. The download files are available from the {ReleaseDownload}. -You can also use the xref:openapi[`GET /openapi` method] to retrieve the OpenAPI v2 specification in JSON format. +You can also use the xref:openapi[`GET /openapi` method] to retrieve the OpenAPI v3 specification in JSON format. [role="_additional-resources"] .Additional resources diff --git a/src/main/java/io/strimzi/kafka/bridge/http/HttpBridge.java b/src/main/java/io/strimzi/kafka/bridge/http/HttpBridge.java index def1e5e7..ac89c813 100644 --- a/src/main/java/io/strimzi/kafka/bridge/http/HttpBridge.java +++ b/src/main/java/io/strimzi/kafka/bridge/http/HttpBridge.java @@ -524,12 +524,12 @@ private void ready(RoutingContext routingContext) { private void openapi(RoutingContext routingContext) { FileSystem fileSystem = vertx.fileSystem(); - fileSystem.readFile(openapiFileName(routingContext), readFile -> { + fileSystem.readFile("openapi.json", readFile -> { if (readFile.succeeded()) { String xForwardedPath = routingContext.request().getHeader("x-forwarded-path"); String xForwardedPrefix = routingContext.request().getHeader("x-forwarded-prefix"); if (xForwardedPath == null && xForwardedPrefix == null) { - HttpUtils.sendFile(routingContext, HttpResponseStatus.OK.code(), BridgeContentType.JSON, openapiFileName(routingContext)); + HttpUtils.sendFile(routingContext, HttpResponseStatus.OK.code(), BridgeContentType.JSON, "openapi.json"); } else { String path = "/"; if (xForwardedPrefix != null) { @@ -553,10 +553,6 @@ private void openapi(RoutingContext routingContext) { }); } - private String openapiFileName(RoutingContext routingContext) { - return "/openapi/v3".equals(routingContext.normalizedPath()) ? "openapi.json" : "openapiv2.json"; - } - private void metrics(RoutingContext routingContext) { routingContext.response() .putHeader("Content-Type", "text/plain; version=0.0.4; charset=utf-8") @@ -843,7 +839,9 @@ public void process(RoutingContext routingContext) { @Override public void process(RoutingContext routingContext) { - openapi(routingContext); + HttpBridgeError error = new HttpBridgeError(HttpResponseStatus.GONE.code(), "OpenAPI v2 Swagger not supported"); + HttpUtils.sendResponse(routingContext, HttpResponseStatus.GONE.code(), + BridgeContentType.KAFKA_JSON, JsonUtils.jsonToBytes(error.toJson())); } }; diff --git a/src/main/resources/openapi.json b/src/main/resources/openapi.json index e14b1a40..dc51164f 100644 --- a/src/main/resources/openapi.json +++ b/src/main/resources/openapi.json @@ -1415,29 +1415,37 @@ } } }, - "description": "OpenAPI v2 specification in JSON format retrieved successfully." + "description": "OpenAPI v3 specification in JSON format retrieved successfully." } }, "operationId": "openapi", - "description": "Retrieves the OpenAPI v2 specification in JSON format." + "description": "Retrieves the OpenAPI v3 specification in JSON format." } }, "/openapi/v2": { "get": { "responses": { - "200": { + "410": { "content": { - "application/json": { + "application/vnd.kafka.v2+json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/Error" + }, + "examples": { + "response": { + "value": { + "error_code": 410, + "message": "OpenAPI v2 Swagger not supported." + } + } } } }, - "description": "OpenAPI v2 specification in JSON format retrieved successfully." + "description": "OpenAPI v2 Swagger not supported." } }, "operationId": "openapiv2", - "description": "Retrieves the OpenAPI v2 specification in JSON format." + "description": "OpenAPI v2 Swagger not supported." } }, "/openapi/v3": { diff --git a/src/main/resources/openapiv2.json b/src/main/resources/openapiv2.json deleted file mode 100644 index e9d59a0a..00000000 --- a/src/main/resources/openapiv2.json +++ /dev/null @@ -1,2105 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Kafka Bridge API Reference", - "description": "The Kafka Bridge provides a REST API for integrating HTTP based client applications with a Kafka cluster. You can use the API to create and manage consumers and send and receive records over HTTP rather than the native Kafka protocol. ", - "version": "0.1.0" - }, - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/consumers/{groupid}": { - "post": { - "tags": [ - "Consumers" - ], - "description": "Creates a consumer instance in the given consumer group. You can optionally specify a consumer name and supported configuration options. It returns a base URI which must be used to construct URLs for subsequent requests against this consumer instance.", - "operationId": "createConsumer", - "consumes": [ - "application/vnd.kafka.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Name and configuration of the consumer. The name is unique within the scope of the consumer group. If a name is not specified, a randomly generated name is assigned. All parameters are optional. The supported configuration options are shown in the following example.", - "required": true, - "schema": { - "$ref": "#/definitions/Consumer" - } - } - ], - "responses": { - "200": { - "description": "Consumer created successfully.", - "schema": { - "$ref": "#/definitions/CreatedConsumer" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "instance_id": "consumer1", - "base_uri": "http://localhost:8080/consumers/my-group/instances/consumer1" - } - } - }, - "409": { - "description": "A consumer instance with the specified name already exists in the Kafka Bridge.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 409, - "message": "A consumer instance with the specified name already exists in the Kafka Bridge." - } - } - }, - "422": { - "description": "One or more consumer configuration options have invalid values.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 422, - "message": "One or more consumer configuration options have invalid values." - } - } - } - } - }, - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group in which to create the consumer.", - "required": true, - "type": "string" - } - ] - }, - "/consumers/{groupid}/instances/{name}/positions/beginning": { - "post": { - "tags": [ - "Seek", - "Consumers" - ], - "description": "Configures a subscribed consumer to seek (and subsequently read from) the first offset in one or more given topic partitions.", - "operationId": "seekToBeginning", - "consumes": [ - "application/vnd.kafka.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "List of topic partitions to which the consumer is subscribed. The consumer will seek the first offset in the specified partitions.", - "required": true, - "schema": { - "$ref": "#/definitions/Partitions" - } - } - ], - "responses": { - "204": { - "description": "Seek to the beginning performed successfully." - }, - "404": { - "description": "The specified consumer instance was not found, or the specified consumer instance did not have one of the specified partitions assigned.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - } - } - }, - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the subscribed consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the subscribed consumer.", - "required": true, - "type": "string" - } - ] - }, - "/consumers/{groupid}/instances/{name}/positions/end": { - "post": { - "tags": [ - "Seek", - "Consumers" - ], - "description": "Configures a subscribed consumer to seek (and subsequently read from) the offset at the end of one or more of the given topic partitions.", - "operationId": "seekToEnd", - "consumes": [ - "application/vnd.kafka.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "List of topic partitions to which the consumer is subscribed. The consumer will seek the last offset in the specified partitions.", - "required": false, - "schema": { - "$ref": "#/definitions/Partitions" - } - } - ], - "responses": { - "204": { - "description": "Seek to the end performed successfully." - }, - "404": { - "description": "The specified consumer instance was not found, or the specified consumer instance did not have one of the specified partitions assigned.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - } - } - }, - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the subscribed consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the subscribed consumer.", - "required": true, - "type": "string" - } - ] - }, - "/consumers/{groupid}/instances/{name}/subscription": { - "get": { - "produces": [ - "application/vnd.kafka.v2+json" - ], - "tags": [ - "Consumers" - ], - "responses": { - "200": { - "description": "List of subscribed topics and partitions.", - "schema": { - "$ref": "#/definitions/SubscribedTopicList" - } - }, - "404": { - "description": "The specified consumer instance was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - } - }, - "operationId": "listSubscriptions", - "description": "Retrieves a list of the topics to which the consumer is subscribed.", - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the subscribed consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the subscribed consumer.", - "required": true, - "type": "string" - } - ] - }, - "post": { - "tags": [ - "Consumers" - ], - "description": "Subscribes a consumer to one or more topics. You can describe the topics to which the consumer will subscribe in a list (of `Topics` type) or as a `topic_pattern` field. Each call replaces the subscriptions for the subscriber.", - "operationId": "subscribe", - "consumes": [ - "application/vnd.kafka.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "List of topics to which the consumer will subscribe.", - "required": true, - "schema": { - "$ref": "#/definitions/Topics" - } - }, - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the subscribed consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the consumer to subscribe to topics.", - "required": true, - "type": "string" - } - ], - "responses": { - "204": { - "description": "Consumer subscribed successfully." - }, - "404": { - "description": "The specified consumer instance was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - }, - "409": { - "description": "Subscriptions to topics, partitions, and patterns are mutually exclusive.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 409, - "message": "Subscriptions to topics, partitions, and patterns are mutually exclusive." - } - } - }, - "422": { - "description": "A list (of `Topics` type) or a `topic_pattern` must be specified.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 422, - "message": "A list (of Topics type) or a topic_pattern must be specified." - } - } - } - } - }, - "delete": { - "tags": [ - "Consumers" - ], - "description": "Unsubscribes a consumer from all topics.", - "operationId": "unsubscribe", - "responses": { - "204": { - "description": "Consumer unsubscribed successfully." - }, - "404": { - "description": "The specified consumer instance was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - } - }, - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the subscribed consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the consumer to unsubscribe from topics.", - "required": true, - "type": "string" - } - ] - } - }, - "/consumers/{groupid}/instances/{name}/positions": { - "post": { - "tags": [ - "Seek", - "Consumers" - ], - "description": "Configures a subscribed consumer to fetch offsets from a particular offset the next time it fetches a set of records from a given topic partition. This overrides the default fetch behavior for consumers. You can specify one or more topic partitions.", - "operationId": "seek", - "consumes": [ - "application/vnd.kafka.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "List of partition offsets from which the subscribed consumer will next fetch records.", - "required": true, - "schema": { - "$ref": "#/definitions/OffsetCommitSeekList" - } - } - ], - "responses": { - "204": { - "description": "Seek performed successfully." - }, - "404": { - "description": "The specified consumer instance was not found, or the specified consumer instance did not have one of the specified partitions assigned.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - } - } - }, - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the subscribed consumer.", - "required": true, - "type": "string" - } - ] - }, - "/consumers/{groupid}/instances/{name}/assignments": { - "post": { - "tags": [ - "Consumers" - ], - "description": "Assigns one or more topic partitions to a consumer.", - "operationId": "assign", - "consumes": [ - "application/vnd.kafka.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "List of topic partitions to assign to the consumer.", - "required": true, - "schema": { - "$ref": "#/definitions/Partitions" - } - } - ], - "responses": { - "204": { - "description": "Partitions assigned successfully." - }, - "404": { - "description": "The specified consumer instance was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - }, - "409": { - "description": "Subscriptions to topics, partitions, and patterns are mutually exclusive.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 409, - "message": "Subscriptions to topics, partitions, and patterns are mutually exclusive." - } - } - } - } - }, - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the consumer to assign topic partitions to.", - "required": true, - "type": "string" - } - ] - }, - "/topics": { - "get": { - "tags": [ - "Topics" - ], - "description": "Retrieves a list of all topics.", - "operationId": "listTopics", - "produces": [ - "application/vnd.kafka.v2+json" - ], - "responses": { - "200": { - "description": "List of topics.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "examples": { - "application/vnd.kafka.v2+json": [ - "topic1", "topic2" - ] - } - } - } - } - }, - "/topics/{topicname}": { - "get": { - "tags": [ - "Topics" - ], - "description": "Retrieves the metadata about a given topic.", - "operationId": "getTopic", - "produces": [ - "application/vnd.kafka.v2+json" - ], - "responses": { - "200": { - "description": "Topic metadata", - "schema": { - "$ref": "#/definitions/TopicMetadata" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "name": "topic", - "offset": 2, - "configs": { - "cleanup.policy": "compact" - }, - "partitions": [ - { - "partition": 1, - "leader": 1, - "replicas": [ - { - "broker": 1, - "leader": true, - "in_sync": true - }, - { - "broker": 2, - "leader": false, - "in_sync": true - } - ] - }, - { - "partition": 2, - "leader": 2, - "replicas": [ - { - "broker": 1, - "leader": false, - "in_sync": true - }, - { - "broker": 2, - "leader": true, - "in_sync": true - } - ] - } - ] - } - } - } - } - }, - "post": { - "tags": [ - "Topics", - "Producer" - ], - "description": "Sends one or more records to a given topic, optionally specifying a partition, key, or both.", - "operationId": "send", - "consumes": [ - "application/vnd.kafka.json.v2+json", - "application/vnd.kafka.binary.v2+json", - "application/vnd.kafka.text.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ProducerRecordList" - } - }, - { - "name": "async", - "in": "query", - "description": "Whether to return immediately upon sending records, instead of waiting for metadata. No offsets will be returned if specified. Defaults to false.", - "required": false, - "type": "boolean" - } - ], - "responses": { - "200": { - "description": "Records sent successfully.", - "schema": { - "$ref": "#/definitions/OffsetRecordSentList" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "offsets": [ - { - "partition": 2, - "offset": 0 - }, - { - "partition": 1, - "offset": 1 - }, - { - "partition": 2, - "offset": 2 - } - ] - } - } - }, - "404": { - "description": "The specified topic was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified topic was not found." - } - } - }, - "422": { - "description": "The record list is not valid.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 422, - "message": "The record list contains invalid records." - } - } - } - } - }, - "parameters": [ - { - "name": "topicname", - "in": "path", - "description": "Name of the topic to send records to or retrieve metadata from.", - "required": true, - "type": "string" - } - ] - }, - "/admin/topics": { - "post": { - "tags": [ - "Topics" - ], - "description": "Creates a topic with given name, partitions count, and replication factor.", - "operationId": "createTopic", - "consumes": [ - "application/vnd.kafka.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/NewTopic" - } - } - ], - "responses": { - "201": { - "description": "Created" - } - } - } - }, - "/consumers/{groupid}/instances/{name}/records": { - "get": { - "tags": [ - "Consumers" - ], - "description": "Retrieves records for a subscribed consumer, including message values, topics, and partitions. The request for this operation MUST use the base URL (including the host and port) returned in the response from the `POST` request to `/consumers/{groupid}` that was used to create this consumer.", - "operationId": "poll", - "produces": [ - "application/vnd.kafka.json.v2+json", - "application/vnd.kafka.binary.v2+json", - "application/vnd.kafka.text.v2+json", - "application/vnd.kafka.v2+json" - ], - "responses": { - "200": { - "description": "Poll request executed successfully.", - "schema": { - "$ref": "#/definitions/ConsumerRecordList" - }, - "examples": { - "application/vnd.kafka.json.v2+json": [ - { - "topic": "topic", - "key": "key1", - "value": { - "foo": "bar" - }, - "partition": 0, - "offset": 2 - }, - { - "topic": "topic", - "key": "key2", - "value": [ - "foo2", - "bar2" - ], - "partition": 1, - "offset": 3 - } - ], - "application/vnd.kafka.binary.v2+json": "[\n {\n \"topic\": \"test\",\n \"key\": \"a2V5\",\n \"value\": \"Y29uZmx1ZW50\",\n \"partition\": 1,\n \"offset\": 100,\n },\n {\n \"topic\": \"test\",\n \"key\": \"a2V5\",\n \"value\": \"a2Fma2E=\",\n \"partition\": 2,\n \"offset\": 101,\n }\n]" - } - }, - "404": { - "description": "The specified consumer instance was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - }, - "406": { - "description": "The `format` used in the consumer creation request does not match the embedded format in the Accept header of this request or the bridge got a message from the topic which is not JSON encoded.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 406, - "message": "The `format` used in the consumer creation request does not match the embedded format in the Accept header of this request." - } - } - }, - "422": { - "description": "Response exceeds the maximum number of bytes the consumer can receive", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 422, - "message": "Response exceeds the maximum number of bytes the consumer can receive" - } - } - } - } - }, - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the subscribed consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the subscribed consumer to retrieve records from.", - "required": true, - "type": "string" - }, - { - "name": "timeout", - "in": "query", - "description": "The maximum amount of time, in milliseconds, that the HTTP Bridge spends retrieving records before timing out the request.", - "required": false, - "type": "integer" - }, - { - "name": "max_bytes", - "in": "query", - "description": "The maximum size, in bytes, of unencoded keys and values that can be included in the response. Otherwise, an error response with code 422 is returned.", - "required": false, - "type": "integer" - } - ] - }, - "/topics/{topicname}/partitions": { - "get": { - "tags": [ - "Topics" - ], - "description": "Retrieves a list of partitions for the topic.", - "operationId": "listPartitions", - "produces": [ - "application/vnd.kafka.v2+json" - ], - "responses": { - "200": { - "description": "List of partitions", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/PartitionMetadata" - } - }, - "examples": { - "application/vnd.kafka.v2+json": [ - { - "partition": 1, - "leader": 1, - "replicas": [ - { - "broker": 1, - "leader": true, - "in_sync": true - }, - { - "broker": 2, - "leader": false, - "in_sync": true - } - ] - }, - { - "partition": 2, - "leader": 2, - "replicas": [ - { - "broker": 1, - "leader": false, - "in_sync": true - }, - { - "broker": 2, - "leader": true, - "in_sync": true - } - ] - } - ] - } - }, - "404": { - "description": "The specified topic was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified topic was not found." - } - } - } - } - }, - "parameters": [ - { - "name": "topicname", - "in": "path", - "description": "Name of the topic to send records to or retrieve metadata from.", - "required": true, - "type": "string" - } - ] - }, - "/topics/{topicname}/partitions/{partitionid}": { - "get": { - "tags": [ - "Topics" - ], - "description": "Retrieves partition metadata for the topic partition.", - "operationId": "getPartition", - "produces": [ - "application/vnd.kafka.v2+json" - ], - "responses": { - "200": { - "description": "Partition metadata", - "schema": { - "$ref": "#/definitions/PartitionMetadata" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "partition": 1, - "leader": 1, - "replicas": [ - { - "broker": 1, - "leader": true, - "in_sync": true - }, - { - "broker": 2, - "leader": false, - "in_sync": true - } - ] - } - } - }, - "404": { - "description": "The specified topic partition was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified topic partition was not found." - } - } - } - } - }, - "post": { - "tags": [ - "Topics", - "Producer" - ], - "description": "Sends one or more records to a given topic partition, optionally specifying a key.", - "operationId": "sendToPartition", - "consumes": [ - "application/vnd.kafka.json.v2+json", - "application/vnd.kafka.binary.v2+json", - "application/vnd.kafka.text.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "List of records to send to a given topic partition, including a value (required) and a key (optional).", - "required": true, - "schema": { - "$ref": "#/definitions/ProducerRecordToPartitionList" - } - }, - { - "name": "async", - "in": "query", - "description": "Whether to return immediately upon sending records, instead of waiting for metadata. No offsets will be returned if specified. Defaults to false.", - "required": false, - "type": "boolean" - } - ], - "responses": { - "200": { - "description": "Records sent successfully.", - "schema": { - "$ref": "#/definitions/OffsetRecordSentList" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "offsets": [ - { - "partition": 2, - "offset": 0 - }, - { - "partition": 1, - "offset": 1 - }, - { - "partition": 2, - "offset": 2 - } - ] - } - } - }, - "404": { - "description": "The specified topic partition was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified topic partition was not found." - } - } - }, - "422": { - "description": "The record is not valid.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 422, - "message": "The record is not valid." - } - } - } - } - }, - "parameters": [ - { - "name": "topicname", - "in": "path", - "description": "Name of the topic to send records to or retrieve metadata from.", - "required": true, - "type": "string" - }, - { - "name": "partitionid", - "in": "path", - "description": "ID of the partition to send records to or retrieve metadata from.", - "required": true, - "type": "integer" - } - ] - }, - "/topics/{topicname}/partitions/{partitionid}/offsets": { - "get": { - "tags": [ - "Topics" - ], - "description": "Retrieves a summary of the offsets for the topic partition.", - "operationId": "getOffsets", - "produces": [ - "application/vnd.kafka.v2+json" - ], - "responses": { - "200": { - "description": "A summary of the offsets for the topic partition.", - "schema": { - "$ref": "#/definitions/OffsetsSummary" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "beginning_offset": 10, - "end_offset": 50 - } - } - }, - "404": { - "description": "The specified topic partition was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified topic partition was not found." - } - } - } - } - }, - "parameters": [ - { - "name": "topicname", - "in": "path", - "description": "Name of the topic containing the partition.", - "required": true, - "type": "string" - }, - { - "name": "partitionid", - "in": "path", - "description": "ID of the partition.", - "required": true, - "type": "integer" - } - ] - }, - "/consumers/{groupid}/instances/{name}": { - "delete": { - "tags": [ - "Consumers" - ], - "description": "Deletes a specified consumer instance. The request for this operation MUST use the base URL (including the host and port) returned in the response from the `POST` request to `/consumers/{groupid}` that was used to create this consumer.", - "operationId": "deleteConsumer", - "consumes": [ - "application/vnd.kafka.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "responses": { - "204": { - "description": "Consumer removed successfully." - }, - "404": { - "description": "The specified consumer instance was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - } - } - }, - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the consumer to delete.", - "required": true, - "type": "string" - } - ] - }, - "/consumers/{groupid}/instances/{name}/offsets": { - "post": { - "tags": [ - "Consumers" - ], - "description": "Commits a list of consumer offsets. To commit offsets for all records fetched by the consumer, leave the request body empty.", - "operationId": "commit", - "consumes": [ - "application/vnd.kafka.v2+json" - ], - "produces": [ - "application/vnd.kafka.v2+json" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "List of consumer offsets to commit to the consumer offsets commit log. You can specify one or more topic partitions to commit offsets for.", - "required": false, - "schema": { - "$ref": "#/definitions/OffsetCommitSeekList" - } - } - ], - "responses": { - "204": { - "description": "Commit made successfully." - }, - "404": { - "description": "The specified consumer instance was not found.", - "schema": { - "$ref": "#/definitions/Error" - }, - "examples": { - "application/vnd.kafka.v2+json": { - "error_code": 404, - "message": "The specified consumer instance was not found." - } - } - } - } - }, - "parameters": [ - { - "name": "groupid", - "in": "path", - "description": "ID of the consumer group to which the consumer belongs.", - "required": true, - "type": "string" - }, - { - "name": "name", - "in": "path", - "description": "Name of the consumer.", - "required": true, - "type": "string" - } - ] - }, - "/healthy": { - "get": { - "responses": { - "204": { - "description": "The bridge is healthy" - }, - "500": { - "description": "The bridge is not healthy" - } - }, - "operationId": "healthy", - "description": "Check if the bridge is running. This does not necessarily imply that it is ready to accept requests." - } - }, - "/ready": { - "get": { - "responses": { - "204": { - "description": "The bridge is ready" - }, - "500": { - "description": "The bridge is not ready" - } - }, - "operationId": "ready", - "description": "Check if the bridge is ready and can accept requests." - } - }, - "/openapi": { - "get": { - "produces": [ - "application/json" - ], - "responses": { - "204": { - "description": "OpenAPI v2 specification in JSON format retrieved successfully.", - "schema": { - "type": "string" - } - } - }, - "operationId": "openapi", - "description": "Retrieves the OpenAPI v2 specification in JSON format." - } - }, - "/openapi/v2": { - "get": { - "produces": [ - "application/json" - ], - "responses": { - "204": { - "description": "OpenAPI v2 specification in JSON format retrieved successfully.", - "schema": { - "type": "string" - } - } - }, - "operationId": "openapiv2", - "description": "Retrieves the OpenAPI v2 specification in JSON format." - } - }, - "/openapi/v3": { - "get": { - "produces": [ - "application/json" - ], - "responses": { - "204": { - "description": "OpenAPI v3 specification in JSON format retrieved successfully.", - "schema": { - "type": "string" - } - } - }, - "operationId": "openapiv3", - "description": "Retrieves the OpenAPI v3 specification in JSON format." - } - }, - "/metrics": { - "get": { - "produces": [ - "text/plain" - ], - "responses": { - "200": { - "description": "Metrics in Prometheus format retrieved successfully.", - "schema": { - "type": "string" - } - } - }, - "operationId": "metrics", - "description": "Retrieves the bridge metrics in Prometheus format." - } - }, - "/": { - "get": { - "produces": [ - "application/json" - ], - "responses": { - "200": { - "description": "Information about Kafka Bridge instance.", - "schema": { - "$ref": "#/definitions/BridgeInfo" - } - } - }, - "operationId": "info", - "description": "Retrieves information about the Kafka Bridge instance, in JSON format." - } - } - }, - "definitions": { - "KafkaHeader": { - "example": { - "key": "key1", - "value": "dmFsdWUx" - }, - "properties": { - "key": { - "type": "string" - }, - "value": { - "format": "byte", - "type": "string", - "description": "The header value in binary format, base64-encoded" - } - }, - "title": "KafkaHeader", - "required": [ - "value", - "key" - ], - "type": "object" - }, - "KafkaHeaderList": { - "title": "KafkaHeaderList", - "type": "array", - "items": { - "$ref": "#/definitions/KafkaHeader" - }, - "example": [ - { - "key": "key1", - "value": "dmFsdWUx" - }, - { - "key": "key2", - "value": "dmFsdWUy" - } - ] - }, - "ConsumerRecord": { - "example": { - "key": "key1", - "offset": 2, - "partition": 0, - "topic": "topic", - "value": "value1", - "timestamp": 1591897790000, - "headers": [ - { - "key": "key1", - "value": "dmFsdWUx" - }, - { - "key": "key2", - "value": "dmFsdWUy" - } - ] - }, - "properties": { - "key": { - "type": [ - "array", - "object", - "string" - ] - }, - "offset": { - "format": "int64", - "type": "integer" - }, - "partition": { - "format": "int32", - "type": "integer" - }, - "topic": { - "type": "string" - }, - "value": { - "type": [ - "array", - "object", - "string", - "null" - ] - }, - "headers": { - "$ref": "#/definitions/KafkaHeaderList" - }, - "timestamp": { - "format": "int64", - "type": "integer" - } - }, - "title": "ConsumerRecord", - "type": "object" - }, - "ConsumerRecordList": { - "title": "ConsumerRecordList", - "type": "array", - "items": { - "$ref": "#/definitions/ConsumerRecord" - }, - "example": [ - { - "topic": "topic", - "key": "key1", - "value": "value1", - "partition": 0, - "offset": 2, - "timestamp": 1591897790000 - }, - { - "topic": "topic", - "key": "key2", - "value": "value2", - "partition": 1, - "offset": 3, - "timestamp": 1591897790002 - } - ] - }, - "CreatedConsumer": { - "title": "CreatedConsumer", - "type": "object", - "properties": { - "instance_id": { - "description": "Unique ID for the consumer instance in the group.", - "type": "string" - }, - "base_uri": { - "description": "Base URI used to construct URIs for subsequent requests against this consumer instance.", - "type": "string" - } - }, - "example": { - "instance_id": "my-consumer", - "base_uri": "http://localhost:8080/consumers/my-group/instances/my-consumer" - } - }, - "OffsetRecordSent": { - "title": "OffsetRecordSent", - "type": "object", - "properties": { - "partition": { - "format": "int32", - "type": "integer" - }, - "offset": { - "format": "int64", - "type": "integer" - } - }, - "example": { - "partition": 31, - "offset": 86 - } - }, - "OffsetRecordSentList": { - "title": "OffsetRecordSentList", - "type": "object", - "properties": { - "offsets": { - "type": "array", - "items": { - "$ref": "#/definitions/OffsetRecordSent" - } - } - }, - "example": { - "offsets": [ - { - "partition": 92, - "offset": 98 - }, - { - "partition": 65, - "offset": 91 - } - ] - } - }, - "OffsetsSummary": { - "title": "OffsetsSummary", - "type": "object", - "properties": { - "beginning_offset": { - "format": "int64", - "type": "integer" - }, - "end_offset": { - "format": "int64", - "type": "integer" - } - }, - "example": { - "beginning_offset": 10, - "end_offset": 50 - } - }, - "Error": { - "title": "Error", - "type": "object", - "properties": { - "error_code": { - "format": "int32", - "type": "integer" - }, - "message": { - "type": "string" - } - }, - "example": "{\n \"error_code\": 404,\n \"message\": \"resource not found\"\n}" - }, - "Consumer": { - "title": "Consumer", - "type": "object", - "properties": { - "name": { - "description": "The unique name for the consumer instance. The name is unique within the scope of the consumer group. The name is used in URLs. If a name is not specified, a randomly generated name is assigned.", - "type": "string" - }, - "format": { - "description": "The allowable message format for the consumer, which can be `binary` (default) or `json`. The messages are converted into a JSON format. ", - "type": "string" - }, - "auto.offset.reset": { - "description": "Resets the offset position for the consumer. If set to `latest` (default), messages are read from the latest offset. If set to `earliest`, messages are read from the first offset.", - "type": "string" - }, - "fetch.min.bytes": { - "description": "Sets the minimum amount of data, in bytes, for the consumer to receive. The broker waits until the data to send exceeds this amount. Default is `1` byte.", - "type": "integer" - }, - "consumer.request.timeout.ms": { - "description": "Sets the maximum amount of time, in milliseconds, for the consumer to wait for messages for a request. If the timeout period is reached without a response, an error is returned. Default is `30000` (30 seconds).", - "type": "integer" - }, - "enable.auto.commit": { - "description": "If set to `true` (default), message offsets are committed automatically for the consumer. If set to `false`, message offsets must be committed manually.", - "type": "boolean" - }, - "isolation.level": { - "description": "If set to `read_uncommitted` (default), all transaction records are retrieved, indpendent of any transaction outcome. If set to `read_committed`, the records from committed transactions are retrieved.", - "type": "string" - } - }, - "additionalProperties": false, - "example": { - "name": "consumer1", - "format": "binary", - "auto.offset.reset": "earliest", - "enable.auto.commit": false, - "fetch.min.bytes": 512, - "consumer.request.timeout.ms": 30000, - "isolation.level": "read_committed" - } - }, - "OffsetCommitSeek": { - "title": "OffsetCommitSeek", - "required": [ - "partition", - "offset", - "topic" - ], - "type": "object", - "properties": { - "partition": { - "format": "int32", - "type": "integer" - }, - "offset": { - "format": "int64", - "type": "integer" - }, - "topic": { - "type": "string" - } - }, - "additionalProperties": false, - "example": { - "partition": 43, - "offset": 92, - "topic": "topic" - } - }, - "OffsetCommitSeekList": { - "title": "OffsetCommitSeekList", - "type": "object", - "properties": { - "offsets": { - "type": "array", - "items": { - "$ref": "#/definitions/OffsetCommitSeek" - } - } - }, - "additionalProperties": false, - "example": { - "offsets": [ - { - "topic": "topic", - "partition": 0, - "offset": 15 - }, - { - "topic": "topic", - "partition": 1, - "offset": 42 - } - ] - } - }, - "Partition": { - "title": "Partition", - "type": "object", - "properties": { - "partition": { - "format": "int32", - "type": "integer" - }, - "topic": { - "type": "string" - } - }, - "additionalProperties": false - }, - "Partitions": { - "title": "Partitions", - "type": "object", - "properties": { - "partitions": { - "type": "array", - "items": { - "$ref": "#/definitions/Partition" - } - } - }, - "additionalProperties": false, - "example": { - "partitions": [ - { - "topic": "topic", - "partition": 0 - }, - { - "topic": "topic", - "partition": 1 - } - ] - } - }, - "ProducerRecord": { - "title": "ProducerRecord", - "required": [ - "value" - ], - "type": "object", - "properties": { - "partition": { - "format": "int32", - "type": "integer" - }, - "timestamp": { - "format": "int64", - "type": "integer" - }, - "value": { - "type": [ - "array", - "object", - "string", - "null" - ] - }, - "key": { - "type": [ - "array", - "object", - "string" - ] - }, - "headers": { - "$ref": "#/definitions/KafkaHeaderList" - } - }, - "additionalProperties": false, - "example": { - "key": "key1", - "partition": 0, - "timestamp": 1591897790000, - "value": "value1", - "headers": [ - { - "key": "key1", - "value": "dmFsdWUx" - }, - { - "key": "key2", - "value": "dmFsdWUy" - } - ] - } - }, - "ProducerRecordList": { - "title": "ProducerRecordList", - "type": "object", - "properties": { - "records": { - "type": "array", - "items": { - "$ref": "#/definitions/ProducerRecord" - } - } - }, - "additionalProperties": false, - "example": { - "records": [ - { - "key": "key1", - "value": "value1" - }, - { - "value": "value2", - "partition": 1 - }, - { - "value": "value3" - } - ] - } - }, - "ProducerRecordToPartition": { - "title": "ProducerRecordToPartition", - "required": [ - "value" - ], - "type": "object", - "properties": { - "value": { - "type": [ - "array", - "object", - "string", - "null" - ] - }, - "key": { - "type": [ - "array", - "object", - "string" - ] - }, - "headers": { - "$ref": "#/definitions/KafkaHeaderList" - } - }, - "additionalProperties": false, - "example": { - "value": { - "v": 128 - }, - "key": { - "k": "key" - } - } - }, - "ProducerRecordToPartitionList": { - "title": "ProducerRecordToPartitionList", - "type": "object", - "properties": { - "records": { - "type": "array", - "items": { - "$ref": "#/definitions/ProducerRecordToPartition" - } - } - }, - "additionalProperties": false, - "example": { - "records": [ - { - "key": "key1", - "value": "value1" - }, - { - "value": "value2" - } - ] - } - }, - "Topics": { - "title": "Topics", - "type": "object", - "properties": { - "topics": { - "type": "array", - "items": { - "type": "string" - } - }, - "topic_pattern": { - "description": "A regex topic pattern for matching multiple topics", - "type": "string" - } - }, - "additionalProperties": false, - "example": { - "topics": [ - "topic1", - "topic2" - ] - } - }, - "AssignedTopicPartitions": { - "title": "AssignedTopicPartitions", - "type": "object", - "additionalProperties": { - "type": "array", - "items": { - "format": "int32", - "type": "integer" - } - }, - "example": { - "my-topic1": [ - 1, - 2, - 3 - ] - } - }, - "SubscribedTopicList": { - "title": "SubscribedTopicList", - "type": "object", - "properties": { - "topics": { - "$ref": "#/definitions/Topics" - }, - "partitions": { - "type": "array", - "items": { - "$ref": "#/definitions/AssignedTopicPartitions" - } - } - }, - "example": { - "topics": [ - "my-topic1", - "my-topic2" - ], - "partitions": [ - { - "my-topic1": [ - 1, - 2, - 3 - ] - }, - { - "my-topic2": [ - 1 - ] - } - ] - } - }, - "TopicMetadata": { - "title": "TopicMetadata", - "type": "object", - "properties": { - "name": { - "description": "Name of the topic", - "type": "string" - }, - "configs": { - "description": "Per-topic configuration overrides", - "type": "object", - "additionalProperties": { - "type": "string" - } - }, - "partitions": { - "type": "array", - "items": { - "$ref": "#/definitions/PartitionMetadata" - } - } - }, - "additionalProperties": false, - "example": { - "name": "topic", - "offset": 2, - "configs": { - "cleanup.policy": "compact" - }, - "partitions": [ - { - "partition": 1, - "leader": 1, - "replicas": [ - { - "broker": 1, - "leader": true, - "in_sync": true - }, - { - "broker": 2, - "leader": false, - "in_sync": true - } - ] - }, - { - "partition": 2, - "leader": 2, - "replicas": [ - { - "broker": 1, - "leader": false, - "in_sync": true - }, - { - "broker": 2, - "leader": true, - "in_sync": true - } - ] - } - ] - } - }, - "PartitionMetadata": { - "title": "PartitionMetadata", - "type": "object", - "properties": { - "partition": { - "format": "int32", - "type": "integer" - }, - "leader": { - "format": "int32", - "type": "integer" - }, - "replicas": { - "type": "array", - "items": { - "$ref": "#/definitions/Replica" - } - } - }, - "additionalProperties": false, - "example": { - "partition": 1, - "leader": 1, - "replicas": [ - { - "broker": 1, - "leader": true, - "in_sync": true - }, - { - "broker": 2, - "leader": false, - "in_sync": true - } - ] - } - }, - "Replica": { - "title": "Replica", - "type": "object", - "properties": { - "broker": { - "format": "int32", - "type": "integer" - }, - "leader": { - "type": "boolean" - }, - "in_sync": { - "type": "boolean" - } - }, - "additionalProperties": false, - "example": { - "broker": 1, - "leader": true, - "in_sync": true - } - }, - "BridgeInfo": { - "title": "BridgeInfo", - "description": "Information about Kafka Bridge instance.", - "type": "object", - "properties": { - "bridge_version": { - "type": "string" - } - }, - "example": { - "bridge_version": "0.16.0" - } - }, - "RecordKey": { - "title": "RecordKey", - "description": "Key representation for a record. It can be an array, a JSON object or a string", - "type": [ - "array", - "object", - "string" - ] - }, - "RecordValue": { - "title": "RecordValue", - "description": "Value representation for a record. It can be an array, a JSON object or a string", - "type": [ - "array", - "object", - "string", - "null" - ] - }, - "NewTopic": { - "title": "NewTopic", - "type": "object", - "properties": { - "topic_name": { - "description": "Name of the topic to create.", - "type": "string" - }, - "partitions_count": { - "description": "Number of partitions for the topic.", - "type": "integer" - }, - "replication_factor": { - "description": "Number of replicas for each partition.", - "type": "integer" - } - }, - "required": ["topic_name"], - "additionalProperties": false, - "example": { - "topic_name": "my-topic", - "partitions_count": 3, - "replication_factor": 2 - } - } - }, - "tags": [ - { - "name": "Consumers", - "description": "Consumer operations to create consumers in your Kafka cluster and perform common actions, such as subscribing to topics, retrieving processed records, and committing offsets." - }, - { - "name": "Topics", - "description": "Topic operations to send messages to a specified topic or topic partition, optionally including message keys in requests. You can also retrieve topics and topic metadata." - }, - { - "name": "Seek", - "description": "Seek operations that enable a consumer to begin receiving messages from a given offset position." - }, - { - "name": "Producer", - "description": "Producer operations to send records to a specified topic or topic partition." - } - ] -} diff --git a/src/test/java/io/strimzi/kafka/bridge/http/OtherServicesIT.java b/src/test/java/io/strimzi/kafka/bridge/http/OtherServicesIT.java index b915547a..b4b77992 100644 --- a/src/test/java/io/strimzi/kafka/bridge/http/OtherServicesIT.java +++ b/src/test/java/io/strimzi/kafka/bridge/http/OtherServicesIT.java @@ -90,11 +90,10 @@ void openapiv2Test(VertxTestContext context) { context.verify(() -> { assertThat(ar.succeeded(), is(true)); HttpResponse response = ar.result(); - assertThat(response.statusCode(), is(HttpResponseStatus.OK.code())); - JsonObject bridgeResponse = response.body(); - - String version = bridgeResponse.getString("swagger"); - assertThat(version, is("2.0")); + HttpBridgeError error = HttpBridgeError.fromJson(response.body()); + assertThat(response.statusCode(), is(HttpResponseStatus.GONE.code())); + assertThat(error.getCode(), is(HttpResponseStatus.GONE.code())); + assertThat(error.getMessage(), is("OpenAPI v2 Swagger not supported")); }); context.completeNow(); }); @@ -131,8 +130,8 @@ void openapiTest(VertxTestContext context) { assertThat(response.statusCode(), is(HttpResponseStatus.OK.code())); JsonObject bridgeResponse = response.body(); - String version = bridgeResponse.getString("swagger"); - assertThat(version, is("2.0")); + String version = bridgeResponse.getString("openapi"); + assertThat(version, is("3.0.0")); Map paths = bridgeResponse.getJsonObject("paths").getMap(); // subscribe, list subscriptions and unsubscribe are using the same endpoint but different methods (-2) @@ -176,7 +175,7 @@ void openapiTest(VertxTestContext context) { assertThat(paths.containsKey("/"), is(true)); assertThat(bridgeResponse.getJsonObject("paths").getJsonObject("/").getJsonObject("get").getString("operationId"), is(HttpOpenApiOperations.INFO.toString())); assertThat(paths.containsKey("/karel"), is(false)); - assertThat(bridgeResponse.getJsonObject("definitions").getMap().size(), is(28)); + assertThat(bridgeResponse.getJsonObject("components").getJsonObject("schemas").getMap().size(), is(28)); assertThat(bridgeResponse.getJsonArray("tags").size(), is(4)); }); context.completeNow();