Skip to content
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

How to define logicalTypes #62

Open
BeyerJC opened this issue Oct 11, 2021 · 7 comments
Open

How to define logicalTypes #62

BeyerJC opened this issue Oct 11, 2021 · 7 comments

Comments

@BeyerJC
Copy link

BeyerJC commented Oct 11, 2021

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.

@xico42
Copy link
Contributor

xico42 commented Oct 25, 2021

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.

@BeyerJC
Copy link
Author

BeyerJC commented Oct 25, 2021

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 ;-)

@xico42
Copy link
Contributor

xico42 commented Oct 25, 2021

About supporting php 8 attributes, I've implemented it on a local fork. I'm just finishing up some details to submit a PR

@xico42
Copy link
Contributor

xico42 commented Oct 25, 2021

Regarding the logical types, it is still not available.

@BeyerJC
Copy link
Author

BeyerJC commented Oct 25, 2021

Great news ! Thanks for your work and this library !
I will look into the logical types and will work on a PR.

@xico42
Copy link
Contributor

xico42 commented Oct 25, 2021

@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.

@xico42
Copy link
Contributor

xico42 commented Oct 25, 2021

It may need some extra work for it to be ready, so feel free to help me out on that PR ;)

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

No branches or pull requests

2 participants