Coder Social home page Coder Social logo

Comments (4)

Horusiath avatar Horusiath commented on August 15, 2024

@kunjee17 this is result of having polymorphic deserialization. This means that each serialized payload knows it's own type, so you don't have to provide it manually upon deserialization.

I.e. if you have an array new Animal[] { new Cat(name:"Sam"), new Dog(name:"Max") } you could deserialize it with serializer.Deserialize<object>(stream) and you'd still have valid types produced with no need to make casts between them. No JSON serializer would be able to do that without embedding type names in its content.

So this is deliberate decision, deeply set into the library itself.

from wire.

kunjee17 avatar kunjee17 commented on August 15, 2024

@Horusiath yeah. Seems like that. But what if I am trying to send data over the wire. It is having type details with it. But on other project, types are not exactly the same. (namespace is different to be precise ). Is there any way to do it in that case?

from wire.

rogeralsing avatar rogeralsing commented on August 15, 2024

@kunjee17 it's a matter of use the right tool for the right problem.
Wire is as @Horusiath says, a polymorphic serializer, meaning it will encode type information in the payload.

While it could in theory be possible to have some form of type replacement support, that feels very much like the wrong way to go.
Use a serializer that fits your needs, it's all about trade offs.

from wire.

kunjee17 avatar kunjee17 commented on August 15, 2024

Thanks @rogeralsing and @Horusiath for details explanation. I am closing the issue.

from wire.

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.