- } else if (leafTypeDef instanceof DecimalTypeDefinition) {
- jsonType = String.valueOf(((DecimalTypeDefinition) leafTypeDef).getRangeConstraints()
- .iterator().next().getMin());
-
- } else if (leafTypeDef instanceof IntegerTypeDefinition) {
- jsonType = String.valueOf(((IntegerTypeDefinition) leafTypeDef).getRangeConstraints()
- .iterator().next().getMin());
-
- } else if (leafTypeDef instanceof UnsignedIntegerTypeDefinition) {
- jsonType = String.valueOf(((UnsignedIntegerTypeDefinition) leafTypeDef).getRangeConstraints()
- .iterator().next().getMin());
+ } else if (leafTypeDef instanceof RangeRestrictedTypeDefinition) {
+ final Number maybeLower = ((RangeRestrictedTypeDefinition<?, ?>) leafTypeDef).getRangeConstraint()
+ .map(RangeConstraint::getAllowedRanges).map(RangeSet::span).map(Range::lowerEndpoint)
+ .orElse(null);
+ jsonType = String.valueOf(maybeLower);