Comments (4)
My first point against this change was that you can't work properly in AQL with this anymore, but then I realized that you can type cast it in AQL with TO_NUMBER(value)
but then you will have data loss. But that same argument is true when we save them as long and double :-)
So I think, from the point of avoiding data loss, we should serialize it as String
👍
With the change on the deserializers I also see no real pain point with backward compatibility.
from java-velocypack.
Yes that's right. I am not 100% satisfied with the current solution. At the time of the initial implementation I was guided by Jackson, which also serialize BigInteger and BigDecimal as numbers.
On the one hand, this is not really a big deal because you can just register a custom VPackSerializer when you need to serialize them as String, on the other hand we might want to offer a more convenient way to change the serialized type for BigInteger and BigDecimal.
A quick search on google shows what possibilities you have with Jackson.
- converting the type in the getter (no option for us because we're not using setter/getter for serialization)
- use a custom serializer by registering a module (which we can already do)
- use a custom serializer by using annotation
JsonSerialize
(providing that kind of annotation is already on my todo list)
I am open to suggestions. Should we change the default to String or just document how the default behavior is and how to easily change it with a custom VPackSerializer.
What we can do in any case is to make the deserializer for BigInteger and BigDecimal compatible with both number and String.
best
Mark
from java-velocypack.
That's not an easy question. But considering that the reason why BigInteger
and BigDecimal
exist is that they can store much larger and more accurate numbers, then we have to ask if it makes sense to reduce them to long
and double
. Doesn't this make the use of both senseless?
What we can do in any case is to make the deserializer for BigInteger and BigDecimal compatible with both number and String.
I totally agree with that.
from java-velocypack.
fixen in 1.1.0
from java-velocypack.
Related Issues (15)
- Feature Request: Provide a way to deserialize polymorphic lists HOT 2
- Support for heterogeneous arrays HOT 3
- VPackParser fails on valid json HOT 3
- VPackBuilder builds invalid unindexed single (small) value array HOT 1
- VPackBuilder misses add(Byte) HOT 1
- VPackParser::fromJson has no variant that takes VPackBuilder.BuilderOptions HOT 1
- VPackParser.toJson v2.5.3 parses String with new lines different than v2.5.2 HOT 1
- serialize and deserialize not support generic types HOT 3
- How to migrate from @SerializedName an @Expose HOT 2
- provide documentation on how to create single element slice HOT 1
- Serialization of negative int value HOT 10
- DateUtil does incorrect conversion of UTC time HOT 2
- Switch to a Jackson for Json HOT 4
- Allow use of type tokens in `VPackDeserializationContext` for deserializing generic Lists HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-velocypack.