grails-marshallers icon indicating copy to clipboard operation
grails-marshallers copied to clipboard

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

Open vahidpaz opened this issue 10 years ago • 14 comments

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"?

vahidpaz avatar Jan 18 '14 02:01 vahidpaz

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

ph4t avatar Jun 04 '14 16:06 ph4t

+1

cesarhdz avatar Jun 17 '14 18:06 cesarhdz

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:

genuinefafa avatar Aug 19 '14 01:08 genuinefafa

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.

aruizca avatar Aug 19 '14 01:08 aruizca

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.

genuinefafa avatar Aug 19 '14 03:08 genuinefafa

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

immutability avatar Jan 23 '15 17:01 immutability

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 avatar Feb 27 '15 16:02 immutability

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! :)

immutability avatar Oct 23 '15 08:10 immutability

I'll try to get it done ASAP On 23 Oct 2015 7:30 PM, "Radoslav Bielik" [email protected] 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 .

aruizca avatar Oct 23 '15 08:10 aruizca

Thanks, that would be awesome!

immutability avatar Oct 29 '15 18:10 immutability

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.

jerrydboonstra avatar Mar 17 '16 10:03 jerrydboonstra

0.7 release has just been submitted for approval.

dhalupa avatar Mar 20 '16 09:03 dhalupa

@dhalupa How long does it usually take for approval?

deel77 avatar Mar 23 '16 12:03 deel77

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

dhalupa avatar Mar 26 '16 10:03 dhalupa