We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
test "works with logicalType field values" do schema = AvroEx.parse_schema!(~S({"type": "record", "name": "Record", "fields": [ {"type": "long", "name": "timestamp", "logicalType": "timestamp-millis"} ]})) timestamp = ~U[2022-02-23 20:28:13.498428Z] assert {:ok, _} = @test_module.encode(schema, %{timestamp: timestamp}) end
Adding a test like this results in
code: assert {:ok, _} = @test_module.encode(schema, %{timestamp: timestamp}) left: {:ok, _} right: {:error, %AvroEx.EncodeError{message: "Schema Mismatch: Expected value of long, got ~U[2022-02-23 20:28:13.498428Z]"}}
The text was updated successfully, but these errors were encountered:
The reason is due to Record.Field failing to take into account logical types when parsing the schema
Record.Field
Sorry, something went wrong.
Turns out they do support them, I was just doing it wrong. If you want a logical type, you need to expand the type.
I should add a strict mode to the parser that raises for unrecognized fields
strict
{ "name": "my_record" "type": "record", "fields": [ {"name": "timestamp", "type": { "type": "long", "logicalType": "timestamp-millis"} } ] }
Successfully merging a pull request may close this issue.
Adding a test like this results in
The text was updated successfully, but these errors were encountered: