Giter Club home page Giter Club logo

Comments (8)

nrwiersma avatar nrwiersma commented on June 12, 2024 1

There is an issue with this though. Why support json and not yaml, and if yaml why not protobuf or mapstructure or any number of other tags, each with their own needs. This, IMO, is the route to a ton of complexity. By keeping things generic we best effort support all tags.

from avro.

nrwiersma avatar nrwiersma commented on June 12, 2024

Are you wanting omitempty on every JSON tag, or just some?

from avro.

adrianiacobghiula avatar adrianiacobghiula commented on June 12, 2024

I would say to be as close as possible to the avro serialized data & considering omitempty feature in json Marschal I would only add omitempty where in avro a union with "null" existed...
On the other hand there might be other opinions here to add to every single field to completely ignore false bool or empty strings or 0 or empty array slice, map to minimize the output.

from avro.

nrwiersma avatar nrwiersma commented on June 12, 2024

I would say to be as close as possible to the avro serialized data & considering omitempty feature in json Marschal I would only add omitempty where in avro a union with "null" existed...

This would require avrogen to "know" about the json tag, which it does not (well, no more than any other tag).

On the other hand there might be other opinions here to add to every single field to completely ignore false bool or empty strings or 0 or empty array slice, map to minimize the output.

omitempty is a very specific tag modifier, and as no specific tags are supported, this would need to be more general, like a set of modifiers. The issue I see here is if one was adding 2 tags, one that supports omitempty and one does not. How would the modifiers be applied, or must they be added per tag. A lot to consider here to make this make sense.

from avro.

adrianiacobghiula avatar adrianiacobghiula commented on June 12, 2024

I am thinking that the simplest would be to make avrogen "know" about json & omitempty (as it will only take a few lines of code) and not tackle a general set of modifiers for any possible tag

from avro.

adrianiacobghiula avatar adrianiacobghiula commented on June 12, 2024

allowing to override the template ? or just parts of the template like: more than just {{ .Tag }} ?

from avro.

nrwiersma avatar nrwiersma commented on June 12, 2024

That would be possible, but the entire thing only I think. It would be best for it to take a string or file, the template needed is not small.

from avro.

nrwiersma avatar nrwiersma commented on June 12, 2024

Closed by #392

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.