rayokota edited a comment on pull request #869: URL: https://github.com/apache/avro/pull/869#issuecomment-621271223
@RyanSkraba , yes, it is to be able to write nested schemas only by name, instead of inlining them. Currently in https://github.com/confluentinc/schema-registry/issues/1432 I am having to place my code in the `org.apache.avro` package because this functionality is available, but is package-private. The motivation behind this is that with Schema Registry, we have a very large customer who wants to be able to evolve and version nested schemas independent of the root schema. In order to do this, the latest versions of nested schemas will be added to the `Parser` dynamically. So the string representation of the root schema (which we reuse) should not contain the inline nested schemas, but only refer to them by name. Below is an example of the output of this method, given a nested or referenced schema with name `acme.Product`. Note that only the name is generated rather than the `acme.Product` schema being generated inline. ``` { "type": "record", "namespace": "acme", "name": "Order", "fields": [ {"name": "order_id", "type": "string"}, {"name": "order_date", "type": "string"}, { "name": "product", "type": "acme.Product" } ] } ``` So given a `Schema` and it's referenced or nested `Schema` instances, this lets us reconstruct the original root schema string given to the `Parser`, so that we can reuse it later. I believe the code for protocols and imports makes use of this same functionality (which is package private), by not generating the imports inline when printing out the protocol definition. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
