Skip to content

Commit 44ed8b0

Browse files
author
bnasslahsen
committed
black and whitelist no longer works because of Spring Data Commons change since SpringBoot 2.3.2. Fixes #814
1 parent e27602d commit 44ed8b0

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/QuerydslPredicateOperationCustomizer.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ public Operation customize(Operation operation, HandlerMethod handlerMethod) {
107107

108108
Map<String, Object> pathSpecMap = getPathSpec(bindings, "pathSpecs");
109109
//remove blacklisted fields
110-
Set<String> blacklist = getFieldValues(bindings, "blackList");
110+
Set<String> blacklist = getFieldValues(bindings, "denyList");
111111
fieldsToAdd.removeIf(blacklist::contains);
112112

113-
Set<String> whiteList = getFieldValues(bindings, "whiteList");
113+
Set<String> whiteList = getFieldValues(bindings, "allowList");
114114
Set<String> aliases = getFieldValues(bindings, "aliases");
115115

116116
fieldsToAdd.addAll(aliases);
@@ -154,9 +154,8 @@ private QuerydslBindings extractQdslBindings(QuerydslPredicate predicate) {
154154
*/
155155
private Set<String> getFieldValues(QuerydslBindings instance, String fieldName) {
156156
try {
157-
Field field = FieldUtils.getDeclaredField(instance.getClass(), fieldName, true);
158-
if (field != null)
159-
return (Set<String>) field.get(instance);
157+
Field field = FieldUtils.getDeclaredField(instance.getClass(),fieldName,true);
158+
return (Set<String>) field.get(instance);
160159
}
161160
catch (IllegalAccessException e) {
162161
LOGGER.warn(e.getMessage());
@@ -173,7 +172,7 @@ private Set<String> getFieldValues(QuerydslBindings instance, String fieldName)
173172
*/
174173
private Map<String, Object> getPathSpec(QuerydslBindings instance, String fieldName) {
175174
try {
176-
Field field = FieldUtils.getDeclaredField(instance.getClass(), fieldName, true);
175+
Field field = FieldUtils.getDeclaredField(instance.getClass(),fieldName,true);
177176
return (Map<String, Object>) field.get(instance);
178177
}
179178
catch (IllegalAccessException e) {
@@ -193,7 +192,7 @@ private Optional<Path<?>> getPathFromPathSpec(Object instance) {
193192
if (instance == null) {
194193
return Optional.empty();
195194
}
196-
Field field = FieldUtils.getDeclaredField(instance.getClass(), "path", true);
195+
Field field = FieldUtils.getDeclaredField(instance.getClass(),"path",true);
197196
return (Optional<Path<?>>) field.get(instance);
198197
}
199198
catch (IllegalAccessException e) {

springdoc-openapi-data-rest/src/test/resources/results/app5.json

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@
3333
}
3434
}
3535
},
36-
{
37-
"name": "codeISO3166",
38-
"in": "query",
39-
"schema": {
40-
"type": "string"
41-
}
42-
},
4336
{
4437
"name": "code",
4538
"in": "query",
@@ -76,13 +69,6 @@
7669
"type": "string"
7770
}
7871
},
79-
{
80-
"name": "dialingCode",
81-
"in": "query",
82-
"schema": {
83-
"type": "string"
84-
}
85-
},
8672
{
8773
"name": "status",
8874
"in": "query",

0 commit comments

Comments
 (0)