porcelli commented on code in PR #6296:
URL:
https://github.com/apache/incubator-kie-drools/pull/6296#discussion_r2020033489
##########
kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/DMNUnaryTestsMapper.java:
##########
@@ -64,7 +65,7 @@ public static void populateSchemaFromUnaryTests(Schema
toPopulate, List<DMNUnary
throw new IllegalArgumentException("At most one null value is
allowed for enum definition");
}
// If there is a NullNode, the item is nullable
- toPopulate.setNullable(!nullNodes.isEmpty());
+ toPopulate.addExtension(X_NULLABLE, !nullNodes.isEmpty());
Review Comment:
@gitgabrio @yesamer @baldimir this also changed, no more native nullable
##########
kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/RangeNodeSchemaMapper.java:
##########
@@ -35,19 +35,33 @@ static void populateSchemaFromListOfRanges(Schema
toPopulate, List<RangeNode> ra
if (range != null) {
if (range.getLowEndPoint() != null) {
if (range.getLowEndPoint() instanceof BigDecimal bigDecimal) {
- toPopulate.minimum(bigDecimal);
+ if (range.getLowBoundary() == Range.RangeBoundary.OPEN){
+ toPopulate.exclusiveMinimum(bigDecimal);
+ } else {
+ toPopulate.minimum(bigDecimal);
+ }
} else {
-
toPopulate.addExtension(DMNOASConstants.X_DMN_MINIMUM_VALUE,
range.getLowEndPoint());
+ if (range.getLowBoundary() == Range.RangeBoundary.OPEN){
+
toPopulate.addExtension(DMNOASConstants.X_DMN_EXCLUSIVE_MINIMUM_VALUE,
range.getLowEndPoint());
+ } else {
+
toPopulate.addExtension(DMNOASConstants.X_DMN_MINIMUM_VALUE,
range.getLowEndPoint());
+ }
Review Comment:
@gitgabrio @yesamer @baldimir the semantics of exclusive-maximum and
exclusive-minimum has changed.
##########
kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/RangeNodeSchemaMapper.java:
##########
@@ -35,19 +35,33 @@ static void populateSchemaFromListOfRanges(Schema
toPopulate, List<RangeNode> ra
if (range != null) {
if (range.getLowEndPoint() != null) {
if (range.getLowEndPoint() instanceof BigDecimal bigDecimal) {
- toPopulate.minimum(bigDecimal);
+ if (range.getLowBoundary() == Range.RangeBoundary.OPEN){
+ toPopulate.exclusiveMinimum(bigDecimal);
+ } else {
+ toPopulate.minimum(bigDecimal);
+ }
Review Comment:
@gitgabrio @yesamer @baldimir the semantics of exclusive-maximum and
exclusive-minimum has changed.
##########
kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/DMNOASConstants.java:
##########
@@ -20,12 +20,15 @@
public class DMNOASConstants {
+ public static final String X_NULLABLE = "nullable";
public static final String X_DMN_TYPE = "x-dmn-type";
public static final String X_DMN_ALLOWED_VALUES = "x-dmn-allowed-values";
public static final String X_DMN_TYPE_CONSTRAINTS =
"x-dmn-type-constraints";
public static final String X_DMN_DESCRIPTIONS = "x-dmn-descriptions";
public static final String X_DMN_MINIMUM_VALUE = "x-dmn-minimum-value";
public static final String X_DMN_MAXIMUM_VALUE = "x-dmn-maximum-value";
+ public static final String X_DMN_EXCLUSIVE_MINIMUM_VALUE =
"x-dmn-exclusive-minimum-value";
+ public static final String X_DMN_EXCLUSIVE_MAXIMUM_VALUE =
"x-dmn-exclusive-maximum-value";
Review Comment:
@gitgabrio @yesamer @baldimir the semantics of exclusive-maximum and
exclusive-minimum has changed.
##########
kie-dmn/kie-dmn-openapi/src/test/java/org/kie/dmn/openapi/impl/RangeNodeSchemaMapperTest.java:
##########
@@ -63,10 +63,10 @@ void evaluateUnaryTestsForDateRange() {
Schema toPopulate = OASFactory.createObject(Schema.class);
RangeNodeSchemaMapper.populateSchemaFromListOfRanges(toPopulate,
ranges);
-
assertThat(toPopulate.getExtensions().get(DMNOASConstants.X_DMN_MINIMUM_VALUE)).isEqualTo(expectedDates.get(0));
- assertThat(toPopulate.getExclusiveMinimum()).isTrue();
+
assertThat(toPopulate.getExtensions().get(DMNOASConstants.X_DMN_EXCLUSIVE_MINIMUM_VALUE)).isEqualTo(expectedDates.get(0));
+
assertThat(toPopulate.getExtensions().get(DMNOASConstants.X_DMN_MINIMUM_VALUE)).isNull();
assertThat(toPopulate.getExtensions().get(DMNOASConstants.X_DMN_MAXIMUM_VALUE)).isEqualTo(expectedDates.get(1));
- assertThat(toPopulate.getExclusiveMaximum()).isFalse();
+
assertThat(toPopulate.getExtensions().get(DMNOASConstants.X_DMN_EXCLUSIVE_MAXIMUM_VALUE)).isNull();
Review Comment:
@gitgabrio @yesamer @baldimir the semantics of exclusive-maximum and
exclusive-minimum has changed.
##########
kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/RangeNodeSchemaMapper.java:
##########
@@ -35,19 +35,33 @@ static void populateSchemaFromListOfRanges(Schema
toPopulate, List<RangeNode> ra
if (range != null) {
if (range.getLowEndPoint() != null) {
if (range.getLowEndPoint() instanceof BigDecimal bigDecimal) {
- toPopulate.minimum(bigDecimal);
+ if (range.getLowBoundary() == Range.RangeBoundary.OPEN){
+ toPopulate.exclusiveMinimum(bigDecimal);
+ } else {
+ toPopulate.minimum(bigDecimal);
+ }
} else {
-
toPopulate.addExtension(DMNOASConstants.X_DMN_MINIMUM_VALUE,
range.getLowEndPoint());
+ if (range.getLowBoundary() == Range.RangeBoundary.OPEN){
+
toPopulate.addExtension(DMNOASConstants.X_DMN_EXCLUSIVE_MINIMUM_VALUE,
range.getLowEndPoint());
+ } else {
+
toPopulate.addExtension(DMNOASConstants.X_DMN_MINIMUM_VALUE,
range.getLowEndPoint());
+ }
}
- toPopulate.exclusiveMinimum(range.getLowBoundary() ==
Range.RangeBoundary.OPEN);
}
if (range.getHighEndPoint() != null) {
if (range.getHighEndPoint() instanceof BigDecimal bigDecimal) {
- toPopulate.maximum(bigDecimal);
+ if (range.getHighBoundary() == Range.RangeBoundary.OPEN ){
+ toPopulate.exclusiveMaximum(bigDecimal);
+ } else {
+ toPopulate.maximum(bigDecimal);
+ }
Review Comment:
@gitgabrio @yesamer @baldimir the semantics of exclusive-maximum and
exclusive-minimum has changed.
##########
kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/RangeNodeSchemaMapper.java:
##########
@@ -35,19 +35,33 @@ static void populateSchemaFromListOfRanges(Schema
toPopulate, List<RangeNode> ra
if (range != null) {
if (range.getLowEndPoint() != null) {
if (range.getLowEndPoint() instanceof BigDecimal bigDecimal) {
- toPopulate.minimum(bigDecimal);
+ if (range.getLowBoundary() == Range.RangeBoundary.OPEN){
+ toPopulate.exclusiveMinimum(bigDecimal);
+ } else {
+ toPopulate.minimum(bigDecimal);
+ }
} else {
-
toPopulate.addExtension(DMNOASConstants.X_DMN_MINIMUM_VALUE,
range.getLowEndPoint());
+ if (range.getLowBoundary() == Range.RangeBoundary.OPEN){
+
toPopulate.addExtension(DMNOASConstants.X_DMN_EXCLUSIVE_MINIMUM_VALUE,
range.getLowEndPoint());
+ } else {
+
toPopulate.addExtension(DMNOASConstants.X_DMN_MINIMUM_VALUE,
range.getLowEndPoint());
+ }
}
- toPopulate.exclusiveMinimum(range.getLowBoundary() ==
Range.RangeBoundary.OPEN);
}
if (range.getHighEndPoint() != null) {
if (range.getHighEndPoint() instanceof BigDecimal bigDecimal) {
- toPopulate.maximum(bigDecimal);
+ if (range.getHighBoundary() == Range.RangeBoundary.OPEN ){
+ toPopulate.exclusiveMaximum(bigDecimal);
+ } else {
+ toPopulate.maximum(bigDecimal);
+ }
} else {
-
toPopulate.addExtension(DMNOASConstants.X_DMN_MAXIMUM_VALUE,
range.getHighEndPoint());
+ if (range.getHighBoundary() == Range.RangeBoundary.OPEN){
+
toPopulate.addExtension(DMNOASConstants.X_DMN_EXCLUSIVE_MAXIMUM_VALUE,
range.getHighEndPoint());
+ } else {
+
toPopulate.addExtension(DMNOASConstants.X_DMN_MAXIMUM_VALUE,
range.getHighEndPoint());
+ }
Review Comment:
@gitgabrio @yesamer @baldimir the semantics of exclusive-maximum and
exclusive-minimum has changed.
##########
kie-dmn/kie-dmn-openapi/src/test/java/org/kie/dmn/openapi/impl/DMNTypeSchemasTest.java:
##########
@@ -123,10 +121,8 @@ void populateSchemaWithRangesForTypeConstraints() {
SimpleTypeImpl toRead = getSimpleType(null, typeConstraintsString,
FEEL_STRING, BuiltInType.STRING);
AtomicReference<Schema> toPopulate = new
AtomicReference<>(getSchemaForSimpleType(toRead));
DMNTypeSchemas.populateSchemaWithConstraints(toPopulate.get(), toRead);
- assertThat(toPopulate.get().getMinimum()).isEqualTo(BigDecimal.ONE);
- assertThat(toPopulate.get().getExclusiveMinimum()).isTrue();
+
assertThat(toPopulate.get().getExclusiveMinimum()).isEqualTo(BigDecimal.ONE);
Review Comment:
@gitgabrio @yesamer @baldimir the semantics of exclusive-maximum and
exclusive-minimum has changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]