mtth / avsc

Avro for JavaScript :zap:
MIT License
1.27k stars 147 forks source link

Improved number type inference #384

Closed nhruo123 closed 2 years ago

nhruo123 commented 2 years ago

I have noticed that the type inference wasn't super strict, this pull request improves on the number type inference as such:

  1. Added a test if the given number is a long
  2. Made sure float is only returned if its within a safe value (within the fraction part of the float)

This might be useful with more strict type Avro schema checker.

nhruo123 commented 2 years ago

Thanks for reviewing, I'll close this issue as it's not as good of an improvement as I initially thought 😅