Skip to content

Commit

Permalink
Fix the JsonPropertySorter logic
Browse files Browse the repository at this point in the history
  • Loading branch information
magicDGS committed Dec 18, 2023
1 parent dc36208 commit d84117f
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ protected int getPropertyIndex(MemberScope<?, ?> property) {
HierarchicType topMostHierarchyType = property.getDeclaringTypeMembers().allTypesAndOverrides().get(0);
List<String> sortedProperties = this.propertyOrderPerDeclaringType
.computeIfAbsent(topMostHierarchyType.getErasedType(), this::getAnnotatedPropertyOrder);
String fieldName;
String fieldName = null;
if (property instanceof MethodScope) {
fieldName = Optional.ofNullable(((MethodScope) property).findGetterField()).map(MemberScope::getSchemaPropertyName).orElse(null);
} else {
}
// also in case that the MethodScope fails, the filename might be provided by the property.getSchemaPropertyName()
if (fieldName == null) {
fieldName = property.getSchemaPropertyName();
}
int propertyIndex = sortedProperties.indexOf(fieldName);
Expand Down

0 comments on commit d84117f

Please sign in to comment.