Skip to content

Commit b4dcc50

Browse files
docs: add samples for nested field filter usage
1 parent 137b89e commit b4dcc50

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

docs/server-jackson.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,36 @@ GET /persons/123?fields=firstName,nickName
198198
=> {"firstName":"John","nickName":"Johnny"}
199199
```
200200
201+
List endpoints apply the field filter to each returned element:
202+
203+
```javascript
204+
GET /people?fields=nickName
205+
206+
=> [{"nickName":"Johnny"}, {"nickName":"Timmy"}]
207+
```
208+
209+
Nested field paths may be selected with dot notation:
210+
211+
```javascript
212+
GET /persons/123?fields=contact.address.city
213+
214+
=> {"contact":{"address":{"city":"Hamburg"}}}
215+
```
216+
217+
Requesting a parent path keeps the full subtree:
218+
219+
```javascript
220+
GET /persons/123?fields=children
221+
222+
=> {"children":[{"firstName":"Jane","lastName":"Doe","nickName":"Junior"}]}
223+
```
224+
225+
The annotation is required on the serialized response type itself. For wrapped responses such as
226+
`{"results":[...]}`, the wrapper class must be annotated as well.
227+
228+
Nested field paths are only applied inside nested objects that are also annotated with `@EnableFieldFilter`.
229+
If a nested object is not annotated, selecting one of its sub-fields keeps the whole nested object.
230+
201231
## Configuration
202232
203233
### Disable HAL support

0 commit comments

Comments
 (0)