How to limit response fields for relationships? #326
-
I'm interesting how to return all data, but limit some fields for specific relationships dynamically like this:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
@NaumenkoSergiy Could you provide the expected input and output? |
Beta Was this translation helpful? Give feedback.
-
For example:
=>
|
Beta Was this translation helpful? Give feedback.
-
@okuramasafumi let's imagine that I have serializer what you provided. And sometimes I want to return only |
Beta Was this translation helpful? Give feedback.
I just wrote a test case for your use case.
https://github.com/okuramasafumi/alba/blob/main/test/usecases/field_selection_test.rb
Basically what we do here is to add another custom DSL to Alba. You can try this out and see how it goes. Let me know if you have some trouble.