GitHub user shodo edited a discussion: Difference between JSON schema and AVRO schema
When checking this section of the doc: https://pulsar.apache.org/docs/3.0.x/schema-understand/ It's not really clear to me what is the difference between a JSON schema and an AVRO schema. When I talk about JSON schema I refer to this specification, basically a JSON to define how a JSON payload is composed: http://json-schema.org/understanding-json-schema/index.html While with avro i refer to this one, a JSON to define how an AVRO payload is composed: https://avro.apache.org/docs/ Both the schemas are written in JSON, but their specifications are quite different. However If i check the Pulsar doc with example in C++ I see that in the AVRO example this string is passed: ```C++ static const std::string exampleSchema = "{\"type\":\"record\",\"name\":\"Example\",\"namespace\":\"test\"," "\"fields\":[{\"name\":\"a\",\"type\":\"int\"},{\"name\":\"b\",\"type\":\"int\"}]}"; Producer producer; ProducerConfiguration producerConf; producerConf.setSchema(SchemaInfo(AVRO, "Avro", exampleSchema)); ``` while in the JSON example: ```C++ Std::string jsonSchema = R"({"type":"record","name":"cpx","fields":[{"name":"re","type":"double"},{"name":"im","type":"double"}]})"; SchemaInfo schemaInfo = SchemaInfo(JSON, "JSON", jsonSchema); ``` Although the two strings are instanced in different ways, the content is pretty similar, and seems they are both respecting the AVRO specification! The only real difference is that the AVRO one has the "namespace" field that is not present in the JSON example. So what's the point of saying that both JSON and AVRO are supported if seems that in both cases the AVRO specification is used? Am I missing something? GitHub link: https://github.com/apache/pulsar/discussions/20260 ---- This is an automatically sent email for commits@pulsar.apache.org. To unsubscribe, please send an email to: commits-unsubscr...@pulsar.apache.org