When issuing a GET request with ?sort=cooking_duration, the org.springframework.data.rest.webmvc.json.JacksonMappingAwareSortTranslator won't translate cooking_duration to cookingDuration and no sorting is performed.
When changing @JsonProperty("cooking_duration") to @JsonProperty("cooking-duration"), and doing a ?sort=cooking-duration request, JacksonMappingAwareSortTranslator properly resolves the property name.
It looks like org.springframework.data.rest.webmvc.json.JacksonMappingAwareSortTranslator.SortTranslator#SPLITTER is used to split the property name with _ and .. I can see the case for splitting on . for nested properties paths, but why would you split on underscores?
Édouard Hue opened DATAREST-1276 and commented
Given a
@Document
annotated class with the following attribute, and an according@RepositoryRestResource
:When issuing a GET request with
?sort=cooking_duration
, theorg.springframework.data.rest.webmvc.json.JacksonMappingAwareSortTranslator
won't translatecooking_duration
tocookingDuration
and no sorting is performed.When changing
@JsonProperty("cooking_duration")
to@JsonProperty("cooking-duration")
, and doing a?sort=cooking-duration
request,JacksonMappingAwareSortTranslator
properly resolves the property name.It looks like
org.springframework.data.rest.webmvc.json.JacksonMappingAwareSortTranslator.SortTranslator#SPLITTER
is used to split the property name with_
and.
. I can see the case for splitting on.
for nested properties paths, but why would you split on underscores?No further details from DATAREST-1276
The text was updated successfully, but these errors were encountered: