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

Options to decode keys as atoms #95

Open
davydog187 opened this issue Feb 6, 2020 · 1 comment
Open

Options to decode keys as atoms #95

davydog187 opened this issue Feb 6, 2020 · 1 comment

Comments

@davydog187
Copy link
Contributor

davydog187 commented Feb 6, 2020

I was looking to decode keys to atoms as an option in cogini/avro_schema@2c07ca2 and cogini/avro_schema#25

However, as far as I can reason through the erlavro decoder hook code, I don't think it is possible to implement this as a decoder hook. In this case, it might make more sense to implement this feature directly into erlavro, and provide options similar to the Jason.decode/2 function.

I am happy to implement, but I would appreciate feedback if I'm wasting my time and this is easily implemented as a decoder hook. Thanks!

@zmstone
Copy link
Contributor

zmstone commented Feb 6, 2020

I'd say go ahead add a new decoder option.

For records and enums, ideally it should be atom() in schema,
i.e. ensure atom() at schema's 'compile' time.
in this case, we do not need to convert binary() to atom() over and over again.
But this is likely a big change and may break backward compatibility.

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