Skip to content

Conversation

bajdzun
Copy link
Contributor

@bajdzun bajdzun commented Dec 7, 2021

Schema registry supports two ways of defining primitive schemas:

{"type": "string"}

and:

"string"

Which are equivalent according to Avro specification.

So, I added option to enable that behaviour by passing --optimizePrimitiveSchemas option.

@nick-zh
Copy link
Member

nick-zh commented Dec 7, 2021

I believe it should be possible to do this with the new optimizer way in a separate optimizer, which would be prefered, to not clutter the main class more ✌️
give a shout if you need guidance on this

* @param array|mixed $data
* @return bool
*/
protected function isPrimitive($data): bool
Copy link
Member

@nick-zh nick-zh Dec 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the better solution would be to enhance SchemaTemplate::isPrimitve and pass it as optional argument to optimize (would not need Interface adjustment -> no break)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned above, you can probably kill this func now and just pass $resolvedTemplate->isPrimitive() to optimize in the merger ✌️

* @param array|mixed $data
* @return bool
*/
protected function isPrimitive($data): bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as mentioned above, you can probably kill this func now and just pass $resolvedTemplate->isPrimitive() to optimize in the merger ✌️

@nick-zh
Copy link
Member

nick-zh commented Dec 8, 2021

@bajdzun lgtm, thx for the addition 🙏

@nick-zh nick-zh merged commit fe1f0d1 into php-kafka:main Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants