pedjak / grails-marshallers

Custom XML and JSON marshallers for Grails in an easy way
Other
29 stars 15 forks source link

Feature Request: Allow only specific properties (like Grails "includes" param) #12

Open vahidpaz opened 10 years ago

vahidpaz commented 10 years ago

I'm currently using the domain class marshalling configuration style. Are you planning to add a counterpart to "ignore" called something like "only"? This would behave like Grails 2.3 respond()'s "includes".

There are times when I want to say "only allow these properties during serialization". Currently it requires using "ignore" but with many list items.

Also, why not deprecate the use of the term "ignore" and go with Grails terminology like "excludes" and "includes"?

ph4t commented 10 years ago

I agree that this would be an useful feature for domain classes that have a lot of properties...

cesarhdz commented 10 years ago

+1

genuinefafa commented 10 years ago

I just started using this plugin in favor over grails standard behavior. Why won't use the same respond parameters inside the marshaller?

I can develop the feature, just need a little hint for where I should look. :smile:

aruizca commented 10 years ago

Hi @genuinefafa

If you refer to this respond: http://grails.org/doc/2.3.11/ref/Controllers/respond.html, then I think this belongs to the controllers scope because it makes use of the request headers. This plugin on the other hand belongs to the domain and command objects scope.

Cheers, Angel.

genuinefafa commented 10 years ago

Hi @aruizca

The respond docs are incomplete. Even the REST docs do not include those arguments, which is weird but not that strange.

The main advantage of using respond AFAIK is that it automatically chooses between as JSON or as XML.

You can see more information here or maybe check this out.

The main advantage of this plugin (grails-marshallers), for me at least, is that it allow me to make deep JSON, and set-up mapping criteria inside the Domain Class.

immutability commented 9 years ago

+1 for the include option - would be more than helpful!

immutability commented 9 years ago

Guys, I'm a github newbie when it comes to pull requests, and a Grails newbie at the same time. But I really needed an include mode since I have a bunch of marshallers where only id/name pairs are needed, so there was a lot of unnecessary bloat in the form of very long ignore lists.

I've got this working on my fork of the plugin (not pushed to github yet) - would you be willing to pull this change into the plugin? Right now I only have it implemented for JSON so I assume I would have to do this for XML as well. The way my implementation works is that include/ignore lists are mutually exclusive. If both are defined, then include takes priority. Let me know what you think - thanks!

immutability commented 9 years ago

Guys, any chance of a new official release of the plugin (i.e. v0.7 published to the Grails plugin repository) in the near future? We'd love to avoid using a custom build for the include option. Thanks! :)

aruizca commented 9 years ago

I'll try to get it done ASAP On 23 Oct 2015 7:30 PM, "Radoslav Bielik" notifications@github.com wrote:

Guys, any chance of a new official release of the plugin (i.e. v0.7 published to the Grails plugin repository) in the near future? We'd love to avoid using a custom build for the include option. Thanks! :)

— Reply to this email directly or view it on GitHub https://github.com/pedjak/grails-marshallers/issues/12#issuecomment-150511295 .

immutability commented 9 years ago

Thanks, that would be awesome!

jerrydboonstra commented 8 years ago

I encourage the author to release the HEAD of master as 0.7. I've forked the plugin and built my own into a private artifactory just to achieve this which everyone can benefit from.

dhalupa commented 8 years ago

0.7 release has just been submitted for approval.

deel77 commented 8 years ago

@dhalupa How long does it usually take for approval?

dhalupa commented 8 years ago

On 23.03.2016 13:41, Dominik Lakatoš wrote:

@dhalupa https://github.com/dhalupa How long does it usually take for approval?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/pedjak/grails-marshallers/issues/12#issuecomment-200330651

Try leaving a comment, it might speed things up https://grails.org/plugins/pending/1451