Dependent schemas
Petkomat opened this issue · 0 comments
Petkomat commented
I would like to use the schema (provided via schema.filename
or schema.string
or anyhow)
{
"type": "record",
"name": "Customer",
"namespace": "com.example",
"fields": [
{
"name": "country_born",
"type": "com.example.Country"
},
{
"name": "country_living",
"type": "com.example.Country"
}
]
}
which depends on the file country.avsc
with the schema
{
"namespace": "com.example"
"name": "Country",
"type": "enum",
"symbols": ["A", "B", "C"]
}
How can I do that?
- I am using Kafka Connect UI docker container based on the image (
landoop/kafka-connect-ui
). - There is also schema-registry available in the same network. I posted the Country schema there and it is accessible at
http://localhost:8081/subjects/country/versions/1
. - All the schemas (in
.avsc
files) reside in the same directory (accessible by the container)
Additional notes:
This kind of works with the following schema:
{
"type": "record",
"name": "Customer",
"namespace": "com.example",
"fields": [
{
"name": "country_born",
"type": {
"name": "Country1",
"type": "enum",
"symbols": ["A", "B", "C"]
}
},
{
"name": "country_living",
"type": {
"name": "Country2",
"type": "enum",
"symbols": ["A", "B", "C"]
}
}
]
}
but it is conceptually wrong to have two different enums Country1
and Country2
. However, in the moment I make the names equal (e.g., Country
, the error appears: "schema.string" : Unable to parse the provided schema