-
I almost put this in as PR, but figured it was worth a discussion first. Based on RFC 7946 I would like to see
Based on the requirement of being a "decimal number" I would say an I would actually propose An alternative option would be to use |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
if the RFC says float we should only do float! as for tuple vs list, it's down to was OpenAPI schema support now. For a long time we had to use tuple. Let's talk about this in an other PR/discussion |
Beta Was this translation helpful? Give feedback.
-
I decided the best thing to do was actually email the geojson working group about this. The thread can be found here: https://mailarchive.ietf.org/arch/msg/geojson/B6N2iLvHxsBD-xTdSHp6Mpo0YVs/ I believe the answer is that JSON is a method of transportation, and does not attempt to limit how a consumer represents a number internally. It just wants to convey values. So it is up to an implementation as to how the handle it. Now, I still find it compelling to use just
If that is not enough, then would it be acceptable to come up with a more generic implementation allowing for overriding |
Beta Was this translation helpful? Give feedback.
-
Thanks everyone 🙏 |
Beta Was this translation helpful? Give feedback.
I decided the best thing to do was actually email the geojson working group about this. The thread can be found here: https://mailarchive.ietf.org/arch/msg/geojson/B6N2iLvHxsBD-xTdSHp6Mpo0YVs/
I believe the answer is that JSON is a method of transportation, and does not attempt to limit how a consumer represents a number internally. It just wants to convey values. So it is up to an implementation as to how the handle it.
Now, I still find it compelling to use just
float
in the pydantic representation of it for a few reasons: