kafka-ui icon indicating copy to clipboard operation
kafka-ui copied to clipboard

Content NOT SUPPORTED: keyword "id", use "$id" for schema ID

Open vicziani opened this issue 1 year ago • 5 comments
trafficstars

Issue submitter TODO list

  • [X] I've looked up my issue in FAQ
  • [X] I've searched for an already existing issues here
  • [X] I've tried running main-labeled docker image and the issue still persists there
  • [X] I'm running a supported version of the application which is listed here

Describe the bug (actual behavior)

I'am using the Apicurio Schema Registry. After I create a JSON schema and try to send a message, I get the following error message:

Content NOT SUPPORTED: keyword "id", use "$id" for schema ID

JSON Schema:

{
  "$id": "https://training.com/EmployeeHasBeenCreatedEvent.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "EmployeeHasBeenCreatedEvent",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "format": "int64",
      "description": "The employee's id."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "description": "The employee's name."
    }
  }
}

Reading messages based on the schema works well.

Expected behavior

Send the message.

Your installation details

Same with v1.0.0 and 4de0d53.

  schema-registry:
    image: apicurio/apicurio-registry-mem:2.6.1.Final
    ports: 
      - "8081:8080"
  kafka-ui:
    #image: ghcr.io/kafbat/kafka-ui:v1.0.0
    image: ghcr.io/kafbat/kafka-ui:4de0d5330d0c615e70fd9693bba265e6536029e9
    depends_on:
      - kafka
      - schema-registry
    ports:
      - 8082:8080
    environment:
      - KAFKA_CLUSTERS_0_NAME=local
      - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka:9093
      - KAFKA_CLUSTERS_0_SCHEMAREGISTRY=http://schema-registry:8080/apis/ccompat/v7
      - DYNAMIC_CONFIG_ENABLED='true'

Steps to reproduce

  1. Create schema
  2. Create topic
  3. Send message

Screenshots

image image image

The JSON is generated by Kafka UI.

Logs

Nothing appears in the log.

Additional context

No response

vicziani avatar Jul 11 '24 17:07 vicziani

Hi vicziani! 👋

Welcome, and thank you for opening your first issue in the repo!

Please wait for triaging by our maintainers.

As development is carried out in our spare time, you can support us by sponsoring our activities or even funding the development of specific issues. Sponsorship link

If you plan to raise a PR for this issue, please take a look at our contributing guide.

github-actions[bot] avatar Jul 11 '24 17:07 github-actions[bot]

  • Is it just one of the schemas or json schemas don't work in general?
  • Are you using SR compatible API in apicurio?

Haarolean avatar Jul 12 '24 23:07 Haarolean

  • For all schema.
  • What does it mean SR compatible? I'am using the Confluent Schema Registry API (Version 7) (/apis/ccompat/v7). As you see the Docker Compose file above:
KAFKA_CLUSTERS_0_SCHEMAREGISTRY=http://schema-registry:8080/apis/ccompat/v7

As you can see on the screenshots, the Kafka UI can download the schema, using it when consuming messages, create sample JSON based on the schema. It only throws error while producing message.

vicziani avatar Jul 14 '24 13:07 vicziani

I tried with another schema draft(http://json-schema.org/draft-07/schema#).

Kafka UI can download the schema, using it when consuming messages, create sample JSON based on the schema.

But another error message while producing message: Content no schema with key or ref "http://json-schema.org/draft-07/schema#". Kafka UI supports only the draft https://json-schema.org/draft/2020-12/schema?!

vicziani avatar Jul 14 '24 13:07 vicziani

@Nilumilak can you take a look, please? It looks like a frontend issue, the validator either can't parse schema references or something.

Haarolean avatar Jul 16 '24 05:07 Haarolean

+1

kbzowski avatar Sep 12 '24 07:09 kbzowski

I am facing the same issue as noted above with schema referencing http://json-schema.org, only in my case it's draft-04. The error message is the same.

alesbukovsky avatar Dec 03 '24 16:12 alesbukovsky

Can someone verify if this works on latest main-tagged image? Should've been fixed within #900

Haarolean avatar Mar 10 '25 15:03 Haarolean