spring-data-rest
spring-data-rest copied to clipboard
translateSort in JacksonMappingAwareSortTranslator returns unsorted for fields on another model
RepositoryRestController does not accept sorting for fields which it does not understand.
In previous versions of Spring even if a field didn't exist in the model which is being exposed by RepositoryRestController/BasePathAwareController it was still working, for example when model looked like that:
public class Model {
private String field;
}
and you asked for anotherField (which does not exist on the backend, but might exist in database for example after executing aggregation in MongoDB)
public class SecondModel {
private String anotherField;
}
Spring was properly mapping sorting to this field.
From version 2.6, this is being overridden in class JacksonMappingAwareSortTranslator and when calling translateSort() for a field that comes from another model, it returns unsorted.