Git Product home page Git Product logo

Comments (5)

anuraags avatar anuraags commented on July 16, 2024

I see that this is probably an artefact of using unions to define enums?

from adl.

timbod7 avatar timbod7 commented on July 16, 2024

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.

anuraags avatar anuraags commented on July 16, 2024

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.

timbod7 avatar timbod7 commented on July 16, 2024

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.

timbod7 avatar timbod7 commented on July 16, 2024

Not an ADL issue...

from adl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.