One of defined way to normalize the avro schema using + Standard Canonical Form Transformation. This involves + stripping unwanted properties and maintain same canonical + ordering. The canonical ordering involves ordering avro + reserved properties followed by custom properties if mentioned while + transforming. Normalization schema which helps to reduce the + total memory size of schema (removed unwanted properties and whitespace) + while transfer avro schema between two system and also reduce the parsing + time for compatibility check and schema evolution. +
+ +Standard Canonical Form is a transformation of a schema
+ into standard canonical ordered. It contains only avro reserved
+ properties "name", "type", "fields", "symbols", "items", "values",
+ "logicalType", "size", "order", "doc", "aliases", "default"
+ and other (custom properties) schema properties.
+
Assuming an input schema (in JSON form) that's already + UTF-8 text for a valid Avro schema (including all + quotes as required by JSON), the following transformations + will produce its Standard Canonical Form:
+int
instead of
+ {"type":"int"}
).namespace
attributes, which are now redundant.type
, name
,
+ fields
, symbols
,
+ items
, values
,
+ logicalType
, size
,
+ order
, doc
+ aliases
and default
.
+ Strip all others user defined properties (e.g., format
).name
, type
,
+ fields
, symbols
,
+ items
, values
,
+ logicalType
, size
,
+ order
, doc
,
+ aliases
, default
.
+ For example, if an object has type
,
+ name
, and size
fields, then the
+ name
field should appear first, followed by the
+ type
and then the size
fields.size
attributes of fixed
schemas).In addition to the standard canonical form transformation, including
+ custom Schema
or Field
properties by
+ passing the properties names while transforming.
+ For example, if an object has format
, type
,
+ name
, and size
fields, then the
+ name
field should appear first, followed by the
+ type
, size
and then format
+ (custom properties) fields.
+