Skip to content

Commit

Permalink
Add default value handling again
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo42 committed Dec 2, 2024
1 parent 81175a3 commit be28cf5
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,15 @@ public PropertyMetadata(JsonSchema value, BeanProperty beanProperty) {

// TODO: should the following be deprecated?
required = beanProperty.getAnnotation(Required.class) != null;
defaultValue = ofNullable(beanProperty.getAnnotation(Default.class)).map(Default::value).orElse(defaultValue);

if (beanProperty.getMetadata().getDefaultValue() != null) {
defaultValue = toTargetType(beanProperty.getType(), beanProperty.getMetadata().getDefaultValue());
} else if (ofNullable(beanProperty.getAnnotation(Default.class)).map(Default::value).isPresent()) {
defaultValue = toTargetType(beanProperty.getType(),
ofNullable(beanProperty.getAnnotation(Default.class)).map(Default::value).get());
} else {
defaultValue = null;
}
}

private void setMinMax(BeanProperty beanProperty,
Expand Down

0 comments on commit be28cf5

Please sign in to comment.