Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATAREST-1280 Add support sort collection resource by associated property. #2328

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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