Comments (5)
I see that this is probably an artefact of using unions to define enums?
from adl.
No. This should definite work as you expect - ie the data should "round trip" through the serialisation. Seems like a bug.
But... there's something strange about your serialised data:
"graphType": {
"disc": "AREA"
}
Did you perhaps use gson to serialise the java object, rather than calling the ADL generated serialisation code?
from adl.
Hmmmm....this is in the context of a http response. So I just return the adl generated object and let the http server work out the serialisation by itself. And I believe you're right, the http server does indeed use gson for the serialisation.
So you think I should first calle object.jsonBinding().toJson()
before returning?
from adl.
Yes. You should be calling object.jsonBinding().toJson()
to generage the json.
These two function:
MyClass.jsonBinding().toJson(...)
MyClass.jsonBinding().fromJson(...)
should be inverses. However, there are (by design) not consistent with the json produced by
Gson gson = new GsonBuilder().create();
gson.toJson(...);
There's a few reasons for this: gson doesn't support generics easily, it's json isn't necessarily consistent with that produced by libraries for other languages etc.
It may be possible to create gson type adapters so that gson can generate ADL compatible json for ADL objects.
from adl.
Not an ADL issue...
from adl.
Related Issues (20)
- Customizable code generation HOT 4
- Generated code is not UTF-8 encoded. HOT 1
- Incorrect typescript StringMap quoting HOT 1
- C++: Implement default values for custom type mappings HOT 1
- Generated more useful java constructors, and helper functions for default values. HOT 1
- Rename Void primitive to Unit HOT 3
- Make enums in typescript be type level strings HOT 2
- Remove Error<T> type from sys.types HOT 1
- Change sys.types.Map serialization to a list of map entries (not pairs) HOT 1
- TypeScript: newtype generates type alias and not proper newtype HOT 2
- Issues in java code generation HOT 1
- Full Example for type alias custom type HOT 14
- Robust serialisation of IEEE 754 NaN and Inf
- TypeScript: support "useUnknownInCatchVariables" compiler option HOT 5
- AdlVoid.java not included in generated runtime if Void not the source adl
- Support aeson 2.0
- Java gen $1 substitution in defaults HOT 1
- `@SerializedName` vs `annotation ... SerializedName` HOT 1
- Java custom types doesn't propagate generic arguments.
- ADL annotations shouldn't allow superfluous fields HOT 1
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 adl.