skyscreamer / yoga

Yoga is RESTful but flexible.
http://yoga.skyscreamer.org/
Apache License 2.0
156 stars 66 forks source link

Adding * as a selector option #240

Closed sduskis closed 10 years ago

sduskis commented 10 years ago

Issue #221 seems popular. A handful of users want something that will include all children at a particular level. This pull request should satisfy that request.

kentongray commented 10 years ago

this looks like a great change (especially for hashmaps), curious about the use of underscore on var naming?

sduskis commented 10 years ago

That's a customization that we can add if there's popular demand for it. The * changes can be used as an example for further extension, if you so desire.

cepage commented 10 years ago

Thanks for keeping the dream alive, Solomon! Looks great.

cabbonizio commented 10 years ago

Looking forward to using this. Curious if this also addresses another request I inquired about...if no selector is specifies then return all fields. I know the * was designed for returning all fields at specific levels. This would be useful for those transitioning clients to using selectors on existing services since they wouldn't be sending a selector initially. Thanks

kentongray commented 10 years ago

You might just look at adding a filter to add a default selector param or hook into yoga. I personally hope this doesn't become a default or at least it is configurable. On May 7, 2014 7:48 PM, "cabbonizio" notifications@github.com wrote:

Looking forward to using this. Curious if this also addresses another request I inquired about...if no selector is specifies then return all fields. I know the * was designed for returning all fields at specific levels. This would be useful for those transitioning clients to using selectors on existing services since they wouldn't be sending a selector initially. Thanks

— Reply to this email directly or view it on GitHubhttps://github.com/skyscreamer/yoga/pull/240#issuecomment-42502359 .

cabbonizio commented 10 years ago

Hi, I updated the dependencies to 1.0.5 and tried the use of the "*". It doesn't seem to be working for me.

As an example, I had a selector like this before that worked well (still works after 1.0.5 upgrade):

selector=showLine(showCode,sourceSeqNbr)

I tried the selector below and the response did not return any fields under the showLine object: selector=showLine(*)

Am I using this incorrectly????

safder-meah commented 9 years ago

I was able to use the "*" selector by extending JSonSelectorView and turning on setStarResolvesToAll and it definitely outputs all the fields in a specific level, however ideally, i would want a way to get all the fields as mentioned by @cabbonizio . I didn't follow what @kentongray meant by "adding a filter". Are you referring to the Jackson 2 filters?