Skip to content

Can't parse default value of 1 as a double #92

@larshesel

Description

@larshesel

Passing the following into AvroEx.decode_schema!/1

{
  "type": "record",
  "name": "record0",
  "namespace": "namespace",
  "fields": [
    {
      "name": "double_test",
      "type": "double",
      "default": 1
    }
  ]
}

gives this error:

     ** (AvroEx.Schema.DecodeError) Invalid default in Field<name=double_test> Schema Mismatch: Expected value of double, got 1

Other validators, like the confluence cloud schema validator, validates this and to me it seems reasonable that an value without decimals should be parsed as a double.

With the following "fix" I was able to make AvroEx do as I wanted: https://github.com/beam-community/avro_ex/compare/master...larshesel:avro_ex:larshesel-double-integer-default?expand=1

I'm sure this is not the final solution - if you think this is an actual error I'd love to create a proper PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions