php-kafka / php-avro-schema-generator

PHP avro subschema merger and experimental PHP Class avro schema generator
BSD 3-Clause "New" or "Revised" License
5 stars 5 forks source link

Handling namespaces of embedded types correctly #13

Closed nick-zh closed 2 years ago

nick-zh commented 2 years ago

It was discovered (@bajdzun ), that the SR does not include namespaces of subtypes when they are in the same space. To cover this a new option --optimizeSubSchemaNamespaces was added (#5, #10) to make this possible without breaking the current behaviour. Upon further investigation it seems this is part of the Avro specification and should be default behaviour, see discussion in (#12). This will be properly addressed and will result in a major release.

Thanks @bajdzun, @healerz & co for the help and uncovering this issue :pray:

nick-zh commented 2 years ago

After some discussions and research, it seems both ways are fine and accepted by Avro. The SR does not optimize namspaces when you register schemas, so the decision was to keep the behaviour as a flag, but name mit more closely to Avro wording --optimizeFullNames. An additional flag --optimizeFieldOrder was added, that orders the fields the same as AvroSchema::parse