Skip to content

Commit

Permalink
DATAREST-1280 Add support sort collection resource by associated prop…
Browse files Browse the repository at this point in the history
  • Loading branch information
mikoto2000 committed Nov 13, 2023
1 parent 2b207b1 commit e60bdac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,6 @@ private List<String> mapPropertyPath(PersistentEntity<?, ?> rootEntity, List<Str

for (PersistentProperty<?> persistentProperty : persistentProperties) {

if (associations.isLinkableAssociation(persistentProperty)) {
return Collections.emptyList();
}

persistentPropertyPath.add(persistentProperty.getName());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 original author or authors.
* Copyright 2016-2023 original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -117,19 +117,19 @@ void shouldMapKnownNestedProperties() {
assertThat(translatedSort.getOrderFor("embedded.someInterface")).isNotNull();
}

@Test // DATAREST-910
void shouldSkipWrongNestedProperties() {
@Test // DATAREST-1280
void shouldKnownAssociationProperties() {

Sort translatedSort = sortTranslator.translateSort(Sort.by("embedded.unknown"),
Sort translatedSort = sortTranslator.translateSort(Sort.by("association.name"),
mappingContext.getRequiredPersistentEntity(Plain.class));

assertThat(translatedSort).isEqualTo(Sort.unsorted());
assertTrue(translatedSort.isSorted());
}

@Test // DATAREST-910, DATAREST-976
void shouldSkipKnownAssociationProperties() {
@Test // DATAREST-910
void shouldSkipWrongNestedProperties() {

Sort translatedSort = sortTranslator.translateSort(Sort.by("association.name"),
Sort translatedSort = sortTranslator.translateSort(Sort.by("embedded.unknown"),
mappingContext.getRequiredPersistentEntity(Plain.class));

assertThat(translatedSort).isEqualTo(Sort.unsorted());
Expand Down

0 comments on commit e60bdac

Please sign in to comment.