Giter Club home page Giter Club logo

Comments (8)

nrwiersma avatar nrwiersma commented on June 12, 2024

What have you tried that is not working?

from avro.

VipulZopSmart avatar VipulZopSmart commented on June 12, 2024

How to publish the data with using union schema? Any examples around that? I want to get some reference how can we do that at the publisher side, and how would we know which schema should be validated against the payload?
Any examples for the same would be appreciated.

from avro.

VipulZopSmart avatar VipulZopSmart commented on June 12, 2024

@nrwiersma any help on this?

from avro.

nrwiersma avatar nrwiersma commented on June 12, 2024

Sure, I suggest you read the README on type conversions, specifically on unions: https://github.com/hamba/avro#types-conversions
and check out the examples on using the library here: https://pkg.go.dev/github.com/hamba/avro/v2#example-package-Usage.

from avro.

VipulZopSmart avatar VipulZopSmart commented on June 12, 2024

@nrwiersma I have the code implemented, the thing is if I have 7 sub-schemas referenced under a union schema, then i'm making 7 avro conns to each of the sub-schemas and using hamba-avro package for parsing and binding the messages. But the thing is I should be able to do this with a single avro conn with union-schema(that contains the reference to all thee sub-schemas), any specific examples around that?

from avro.

nrwiersma avatar nrwiersma commented on June 12, 2024

No, that is a really specific thing to do, and not the "basic" case, which is what is covered in the docs. I would suspect it is no different from encoding anything other schema data.

from avro.

VipulZopSmart avatar VipulZopSmart commented on June 12, 2024

@nrwiersma How will we get to know which schema to use from the union-schema refs for marshalling the payload?

from avro.

nrwiersma avatar nrwiersma commented on June 12, 2024

It will be based on the data/payload you are encoding. If you use a map, the first and only key is used to select the type/name of the schema, if it is an interface, it will resolve the schema from the registrar. This is all explained in the README.

from avro.

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.