JSON Payload with Schema Validation on Kafka REST Proxy

I tried to achieve the scenario where JSON Payload with Schema Validation on Kafka REST Proxy should be done. I followed the below steps but getting the error, can someone please help me on this,
Step-1 – Created Topic and configured confluent.value.schema.validation = true
Step-2 – Added Avro Schema to that Topic
Step-3 – Tried to produce the below sample message to topic using rest-proxy

{
    "value_schema_id": "100032",
    "records": [
		{
			"key": "1111",
			"value": {
				"id": 11,
				"name": "Maarten",
				"faxNumber": "1234567890"
			}
		}
	]
}

But I am getting below error, can someone please help me on this,

{
    "offsets": [
        {
            "partition": null,
            "offset": null,
            "error_code": 50002,
            "error": "One or more records have been rejected due to 1 record errors in total, and only showing the first three errors at most: [RecordError(batchIndex=0, message='Record DefaultRecord(offset=0, timestamp=1678333249854, key=6 bytes, value=51 bytes) is rejected by the record interceptor io.confluent.cloud.kafka.schemaregistry.validator.CloudRecordSchemaValidator')]"
        }
    ],
    "key_schema_id": null,
    "value_schema_id": null
}

Hi, i have quite the same issue, have you found a solution ?

For me the erreor is : interceptor io.confluent.cloud.kafka.schemaregistry.validator.CloudRecordSchemaValidator

I also encounter this issue with v3 rest proxy endpoint.

The solution was adding a “type” property for the value and key payload.

{
“value”: {
“type”:“JSON”,
“data”: {
“name”: “Name”,
“age”: 10,
“salary”: 19,
“time”:“August 21 2023”
}
},
“key”:{
“type”:“JSON”,
“data”:“YOUR KEY”
}
}

1 Like