【发布时间】:2020-09-28 19:21:01
【问题描述】:
OS: Ubuntu 18.x
docker image (from dockerhub.com, as of 2020-09-25): confluentinc/cp-schema-registry:latest
我正在探索 Confluent Schema Registry 的 HTTP API。首先,关于注册表假定的 JSON Schema 定义的版本是否有明确的断言?现在,我假设Draft v7.0。更广泛地说,我相信返回支持模式的 API 应该列出版本。例如,而不是:
$ curl -X GET http://localhost:8081/schemas/types
["JSON","PROTOBUF","AVRO"]
你会:
$ curl -X GET http://localhost:8081/schemas/types
[{"flavor": "JSON", "version": "7.0"}, {"flavor": "PROTOBUF", "version": "1.2"}, {"flavor": "AVRO", "version": "3.5"}]
所以至少程序员可以确定架构注册表的假设。
撇开这个问题不谈,我似乎无法将一个相当简单的 JSON 模式发布到注册表:
$ curl -X POST -H "Content-Type: application/vnd.schemaregistry.v1+json" --data '{ "schema": "{ \"type\": \"object\", \"properties\": { \"f1\": { \"type\": \"string\" } } }" }' http://localhost:8081/subjects/mytest-value/versions
{"error_code":42201,"message":"Either the input schema or one its references is invalid"}
在这里,我将架构发布到 mytest 主题。顺便说一下,我从 Confluent 文档中抓取了架构,然后相应地对其进行了转义。
你能说出为什么这个模式没有 POST 到注册表吗?更一般地说,我可以假设完全支持 JSON Schema 定义的 Draft v7.0 吗?
【问题讨论】:
标签: confluent-platform confluent-schema-registry