hamba / avro

A fast Go Avro codec
MIT License
368 stars 93 forks source link

Serialize schemas feature #400

Open ludovic-pourrat opened 4 months ago

ludovic-pourrat commented 4 months ago

Hi, We currently leverage the hamba/avro to resolve our schemas and their dependencies and we need a feature to serialize the schemas once resolved, this is pretty useful when storing the schemas within a registry, like confluent or apicurio.

nrwiersma commented 4 months ago

The scheme can already be marshalled into JSON or in canonical form. Your proposed PR cannot work, as it would instantly break in the case of a circular schema.

ludovic-pourrat commented 4 months ago

The scheme can already be marshalled into JSON or in canonical form. Your proposed PR cannot work, as it would instantly break in the case of a circular schema.

Could you point me to the method to use ? Thanks.

nrwiersma commented 4 months ago

for marshalling to JSON, you literally just use json.Marshal. For canonical form, use the String method on the schema.