-
Notifications
You must be signed in to change notification settings - Fork 6
Added option to optimize primitive schemas before exporting them to a file #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added option to optimize primitive schemas before exporting them to a file #19
Conversation
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 ✌️ |
src/Optimizer/AbstractOptimizer.php
Outdated
* @param array|mixed $data | ||
* @return bool | ||
*/ | ||
protected function isPrimitive($data): bool |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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 ✌️
src/Optimizer/AbstractOptimizer.php
Outdated
* @param array|mixed $data | ||
* @return bool | ||
*/ | ||
protected function isPrimitive($data): bool |
There was a problem hiding this comment.
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 ✌️
@bajdzun lgtm, thx for the addition 🙏 |
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.