Skip to content

Commit

Permalink
Change JsonIgnoreProperties
Browse files Browse the repository at this point in the history
Rather than ignoring all properties with @JsonIgnoreProperties, we only ignore if it doesn't have the "allowGetters" = true

Since if it allowsGetters, you are going to receive it as part of the response
  • Loading branch information
HaruhiSuzumiyah authored and frantuma committed Jun 1, 2023
1 parent 32445ed commit 7959c88
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2146,20 +2146,23 @@ protected Set<String> resolveIgnoredProperties(Annotations a, Annotation[] annot
Set<String> propertiesToIgnore = new HashSet<>();
JsonIgnoreProperties ignoreProperties = a.get(JsonIgnoreProperties.class);
if (ignoreProperties != null) {
propertiesToIgnore.addAll(Arrays.asList(ignoreProperties.value()));
if(!ignoreProperties.allowGetters()) {
propertiesToIgnore.addAll(Arrays.asList(ignoreProperties.value()));
}
}
propertiesToIgnore.addAll(resolveIgnoredProperties(annotations));
return propertiesToIgnore;
}

protected Set<String> resolveIgnoredProperties(Annotation[] annotations) {

Set<String> propertiesToIgnore = new HashSet<>();
if (annotations != null) {
for (Annotation annotation : annotations) {
if (annotation instanceof JsonIgnoreProperties) {
propertiesToIgnore.addAll(Arrays.asList(((JsonIgnoreProperties) annotation).value()));
break;
if (!((JsonIgnoreProperties) annotation).allowGetters()) {
propertiesToIgnore.addAll(Arrays.asList(((JsonIgnoreProperties) annotation).value()));
break;
}
}
}
}
Expand Down

0 comments on commit 7959c88

Please sign in to comment.