jsonapi icon indicating copy to clipboard operation
jsonapi copied to clipboard

Allow conditionally hidden fields

Open protestContest opened this issue 1 year ago • 2 comments

The hidden/0 view callback is handy to remove sensitive fields in views. In some cases, an API may want to hide certain fields by default, but show them in some cases (in my application's case, some fields should be visible if specifically requested as part of a sparse fieldset).

It would be handy if the hidden callback accepted conn as an argument, so the application could decide what fields to hide for a particular request.

Any thoughts on this? I'm happy to open a PR for the change.

Related issue: #68

protestContest avatar Feb 22 '24 18:02 protestContest

that sounds like a reasonable solution as long as you don't need to omit any relationships (really, anything outside of attributes) conditionally. just cuz the hidden/0 function only operates on fields to begin with.

mattpolzin avatar Feb 23 '24 17:02 mattpolzin

This issue has been automatically marked as "stale:discard". We are sorry that we haven't been able to prioritize it yet. If this issue still relevant, please leave any comment if you have any new additional information that helps to solve this issue. We encourage you to create a pull request, if you can. We are happy to help you with that.

github-actions[bot] avatar Jun 26 '24 02:06 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still relevant, feel free to re-open the issue. Thank you!

github-actions[bot] avatar Nov 05 '24 02:11 github-actions[bot]