php-kafka / php-avro-schema-generator

PHP avro subschema merger and experimental PHP Class avro schema generator
BSD 3-Clause "New" or "Revised" License
5 stars 5 forks source link

json_encode with preserve zero fraction flag #60

Closed andrei-arobs closed 1 year ago

andrei-arobs commented 1 year ago

:wave: unsolicited PR incoming...

We figured out that in some cases the compiled schema drops the floating point because of the json_encode.

{
      "name": "score",
      "type": "double",
      "default": 0.0,
}

{"name":"score","type":"double","default":0}

Adding JSON_PRESERVE_ZERO_FRACTION to json_encode fixes the issue. Would love to hear some feedback if you think this is ok.

nick-zh commented 1 year ago

Thx @andrei-arobs :tada: