avro-serde-php
avro-serde-php copied to clipboard
How to define logicalTypes
Hi everyone !
I'm trying to define a field as "timestamp-millis" and i can see that this definition does exist in the code as type long with a logical type. But i dont see any usage of it in the tests and it seems to be unavailable as type in the annotations Avro\AvroType.
Can anyone give me an example on how to define it ? If its not available right now, i can work on a PR adding it.
Hy @WhiteRabbitDE how are you trying to define the field?
You could use the Schema::timestampMillis()
method. But if you're interested in defining it through annotations, I believe it would be needed to implement it.
A good starting point could be the FlixTech\AvroSerializer\Objects\Schema\Generation\TypeMapper
class.
Hey @fcoedno ,
yes. I try to define it using annotations. If its not available yet, i will work on a PR. Are there also any plans right now to support attributes ? If not, i know what to work on afterwards ;-)
About supporting php 8 attributes, I've implemented it on a local fork. I'm just finishing up some details to submit a PR
Regarding the logical types, it is still not available.
Great news ! Thanks for your work and this library ! I will look into the logical types and will work on a PR.
@WhiteRabbitDE I've just opened the php8 attributes PR (#64). But I've implemented it only for php >= 8.1, because php 8.0 does not support nested attributes.
It may need some extra work for it to be ready, so feel free to help me out on that PR ;)