Skip to content

Commit 0c08f19

Browse files
committed
quarkus 3.20.0 upgrade
1 parent a4b7115 commit 0c08f19

13 files changed

+108
-57
lines changed

build-parent/pom.xml

+24-6
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
<version.commons-logging>1.1.1</version.commons-logging>
6161
<version.commons-io>2.15.1</version.commons-io>
6262
<version.common-text>1.11.0</version.common-text>
63-
<version.com.fasterxml.jackson>2.17.2</version.com.fasterxml.jackson>
64-
<version.com.fasterxml.jackson.databind>2.17.2</version.com.fasterxml.jackson.databind>
65-
<version.com.fasterxml.jackson.annotations>2.17.2</version.com.fasterxml.jackson.annotations>
66-
<version.com.github.victools>4.31.0</version.com.github.victools> <!-- victools should align with Jackson if possible -->
63+
<version.com.fasterxml.jackson>2.18.2</version.com.fasterxml.jackson>
64+
<version.com.fasterxml.jackson.databind>2.18.2</version.com.fasterxml.jackson.databind>
65+
<version.com.fasterxml.jackson.annotations>2.18.2</version.com.fasterxml.jackson.annotations>
66+
<version.com.github.victools>4.37.0</version.com.github.victools> <!-- victools should align with Jackson if possible -->
6767
<version.com.miglayout>3.7.4</version.com.miglayout>
6868
<version.domino-slf4j-logger>1.0.1</version.domino-slf4j-logger>
6969
<version.com.google.protobuf>3.25.5</version.com.google.protobuf>
@@ -73,10 +73,12 @@
7373
<version.com.thoughtworks.xstream>1.4.21</version.com.thoughtworks.xstream>
7474
<version.guru.nidi>0.18.0</version.guru.nidi>
7575
<version.info.picocli>4.7.5</version.info.picocli>
76-
<version.io.micrometer>1.12.2</version.io.micrometer>
76+
<version.io.micrometer>1.14.5</version.io.micrometer>
7777
<version.io.quarkus>3.20.0</version.io.quarkus>
7878
<version.io.netty>4.1.118.Final</version.io.netty>
79-
<version.io.smallrye.openapi.core>3.10.0</version.io.smallrye.openapi.core>
79+
<version.io.smallrye.openapi.core>4.0.8</version.io.smallrye.openapi.core>
80+
<version.io.smallrye.config.core>3.11.4</version.io.smallrye.config.core>
81+
8082
<version.it.unimi.dsi.fastutil>8.5.11</version.it.unimi.dsi.fastutil>
8183
<version.junit>4.13.1</version.junit>
8284
<version.net.java.dev.glazedlists>1.8.0</version.net.java.dev.glazedlists>
@@ -412,6 +414,22 @@
412414
<version>${version.io.smallrye.openapi.core}</version>
413415
</dependency>
414416

417+
<dependency>
418+
<groupId>io.smallrye.config</groupId>
419+
<artifactId>smallrye-config</artifactId>
420+
<version>${version.io.smallrye.config.core}</version>
421+
<exclusions>
422+
<exclusion>
423+
<groupId>org.osgi</groupId>
424+
<artifactId>org.osgi.annotation.versioning</artifactId>
425+
</exclusion>
426+
<exclusion>
427+
<groupId>org.ow2.asm</groupId>
428+
<artifactId>asm</artifactId>
429+
</exclusion>
430+
</exclusions>
431+
</dependency>
432+
415433
<dependency>
416434
<groupId>org.eclipse.parsson</groupId>
417435
<artifactId>parsson</artifactId>

kie-dmn/kie-dmn-openapi/pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@
9494
<scope>provided</scope>
9595
</dependency>
9696

97+
<dependency>
98+
<groupId>io.smallrye.config</groupId>
99+
<artifactId>smallrye-config</artifactId>
100+
<scope>test</scope>
101+
</dependency>
102+
97103
<dependency>
98104
<groupId>org.junit.jupiter</groupId>
99105
<artifactId>junit-jupiter-api</artifactId>

kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/DMNOASConstants.java

+3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020

2121
public class DMNOASConstants {
2222

23+
public static final String X_NULLABLE = "nullable";
2324
public static final String X_DMN_TYPE = "x-dmn-type";
2425
public static final String X_DMN_ALLOWED_VALUES = "x-dmn-allowed-values";
2526
public static final String X_DMN_TYPE_CONSTRAINTS = "x-dmn-type-constraints";
2627
public static final String X_DMN_DESCRIPTIONS = "x-dmn-descriptions";
2728
public static final String X_DMN_MINIMUM_VALUE = "x-dmn-minimum-value";
2829
public static final String X_DMN_MAXIMUM_VALUE = "x-dmn-maximum-value";
30+
public static final String X_DMN_EXCLUSIVE_MINIMUM_VALUE = "x-dmn-exclusive-minimum-value";
31+
public static final String X_DMN_EXCLUSIVE_MAXIMUM_VALUE = "x-dmn-exclusive-maximum-value";
2932

3033
private DMNOASConstants() {
3134
// no constructor for contants/utility classes.

kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/DMNOASGeneratorImpl.java

+14-5
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818
*/
1919
package org.kie.dmn.openapi.impl;
2020

21+
import com.fasterxml.jackson.databind.JsonNode;
22+
import com.fasterxml.jackson.databind.node.ArrayNode;
2123
import com.fasterxml.jackson.databind.node.ObjectNode;
22-
import io.smallrye.openapi.runtime.io.JsonUtil;
23-
import io.smallrye.openapi.runtime.io.schema.SchemaWriter;
24+
import io.smallrye.openapi.api.OpenApiConfig;
25+
import io.smallrye.openapi.runtime.io.IOContext;
26+
import io.smallrye.openapi.runtime.io.JsonIO;
27+
import io.smallrye.openapi.runtime.io.media.SchemaIO;
28+
import org.eclipse.microprofile.config.ConfigProvider;
2429
import org.eclipse.microprofile.openapi.models.media.Schema;
2530
import org.kie.dmn.api.core.DMNModel;
2631
import org.kie.dmn.api.core.DMNType;
@@ -54,10 +59,14 @@ public class DMNOASGeneratorImpl implements DMNOASGenerator {
5459
private NamingPolicy namingPolicy;
5560
private final Map<DMNType, Schema> schemas = new HashMap<>();
5661
private ObjectNode jsonSchema;
62+
private JsonIO<JsonNode, ArrayNode, ObjectNode, ArrayNode, ObjectNode> jsonIO;
63+
private SchemaIO<JsonNode, ArrayNode, ObjectNode, ArrayNode, ObjectNode> schemaIO;
5764

5865
public DMNOASGeneratorImpl(Collection<DMNModel> models, String refPrefix) {
5966
this.dmnModels = new ArrayList<>(models);
6067
this.refPrefix = refPrefix;
68+
this.jsonIO = JsonIO.newInstance(OpenApiConfig.fromConfig(ConfigProvider.getConfig()));
69+
this.schemaIO = new SchemaIO<>(IOContext.forJson(jsonIO));
6170
}
6271

6372
@Override
@@ -79,14 +88,14 @@ private void indexModels() {
7988
}
8089

8190
private void prepareSerializaton() {
82-
ObjectNode tree = JsonUtil.objectNode();
83-
ObjectNode definitions = JsonUtil.objectNode();
91+
ObjectNode tree = jsonIO.createObject();
92+
ObjectNode definitions = jsonIO.createObject();
8493
tree.set("definitions", definitions);
8594
// It would be better if the map is a TreeMap, however that breaks test ProcessItemTest.test_together
8695
// For some reason, it looks like there is some reliance on the map being a HashMap, which should be investigated later as that should never happen.
8796
final List<Entry<DMNType, Schema>> sortedEntries = schemas.entrySet().stream().sorted(Map.Entry.comparingByKey(Comparator.comparing(DMNType::getName))).toList();
8897
for (Entry<DMNType, Schema> kv : sortedEntries) {
89-
SchemaWriter.writeSchema(definitions, kv.getValue(), namingPolicy.getName(kv.getKey()));
98+
definitions.set(namingPolicy.getName(kv.getKey()), schemaIO.write(kv.getValue()).get());
9099
}
91100
jsonSchema = tree;
92101
}

kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/DMNTypeSchemas.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private Optional<Map<String, String>> ioSetDoc(DMNType t) {
147147
}
148148

149149
private Schema schemaFromCompositeType(CompositeTypeImpl ct) {
150-
Schema schema = OASFactory.createObject(Schema.class).type(SchemaType.OBJECT);
150+
Schema schema = OASFactory.createObject(Schema.class).addType(SchemaType.OBJECT);
151151
if (ct.getBaseType() == null) { // main case
152152
for (Entry<String, DMNType> fkv : ct.getFields().entrySet()) {
153153
schema.addProperty(fkv.getKey(), refOrBuiltinSchema(fkv.getValue()));
@@ -170,7 +170,7 @@ private void processIoSetDoc(final Schema schema, final DMNType type) {
170170

171171
private Schema nestAsItemIfCollection(Schema original, DMNType t) {
172172
if (t.isCollection()) {
173-
return OASFactory.createObject(Schema.class).type(SchemaType.ARRAY).items(original);
173+
return OASFactory.createObject(Schema.class).addType(SchemaType.ARRAY).items(original);
174174
} else {
175175
return original;
176176
}

kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/DMNUnaryTestsMapper.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.slf4j.LoggerFactory;
4545

4646
import static java.util.stream.Collectors.groupingBy;
47+
import static org.kie.dmn.openapi.impl.DMNOASConstants.X_NULLABLE;
4748
import static org.kie.dmn.openapi.impl.RangeNodeSchemaMapper.populateSchemaFromListOfRanges;
4849

4950
public class DMNUnaryTestsMapper {
@@ -64,7 +65,7 @@ public static void populateSchemaFromUnaryTests(Schema toPopulate, List<DMNUnary
6465
throw new IllegalArgumentException("At most one null value is allowed for enum definition");
6566
}
6667
// If there is a NullNode, the item is nullable
67-
toPopulate.setNullable(!nullNodes.isEmpty());
68+
toPopulate.addExtension(X_NULLABLE, !nullNodes.isEmpty());
6869
if (enumBaseNodes.size() > nullNodes.size()) {
6970
// Let's create enum only if there is at least one node != NullNode
7071
enumBaseNodes.forEach(unaryEvaluationNode -> populateSchemaFromBaseNode(toPopulate, unaryEvaluationNode));

kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/FEELBuiltinTypeSchemaMapper.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import org.kie.dmn.feel.lang.types.BuiltInType;
2727
import org.kie.dmn.typesafe.DMNTypeUtils;
2828

29+
import java.util.List;
30+
2931
public class FEELBuiltinTypeSchemaMapper {
3032

3133
public static Schema from(DMNType t) {
@@ -41,10 +43,10 @@ private static Schema convertDurationToSchema(DMNType t) {
4143
switch (t.getName()) {
4244
case SimpleType.YEARS_AND_MONTHS_DURATION:
4345
case "yearMonthDuration":
44-
return OASFactory.createObject(Schema.class).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:years and months duration").type(SchemaType.STRING).format("years and months duration").example("P1Y2M");
46+
return OASFactory.createObject(Schema.class).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:years and months duration").addType(SchemaType.STRING).format("years and months duration").examples(List.of("P1Y2M"));
4547
case SimpleType.DAYS_AND_TIME_DURATION:
4648
case "dayTimeDuration":
47-
return OASFactory.createObject(Schema.class).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:days and time duration").type(SchemaType.STRING).format("days and time duration").example("P1D");
49+
return OASFactory.createObject(Schema.class).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:days and time duration").addType(SchemaType.STRING).format("days and time duration").examples(List.of("P1D"));
4850
default:
4951
throw new IllegalArgumentException();
5052
}
@@ -55,17 +57,17 @@ private static Schema convertBuiltInToJavaClass(BuiltInType builtin) {
5557
case UNKNOWN:
5658
return OASFactory.createObject(Schema.class).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:Any"); // intentional, do NOT add .type(SchemaType.OBJECT), the JSONSchema to represent FEEL:Any is {}
5759
case DATE:
58-
return OASFactory.createObject(Schema.class).type(SchemaType.STRING).format("date").addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:date");
60+
return OASFactory.createObject(Schema.class).addType(SchemaType.STRING).format("date").addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:date");
5961
case TIME:
60-
return OASFactory.createObject(Schema.class).type(SchemaType.STRING).format("time").addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:time");
62+
return OASFactory.createObject(Schema.class).addType(SchemaType.STRING).format("time").addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:time");
6163
case DATE_TIME:
62-
return OASFactory.createObject(Schema.class).type(SchemaType.STRING).format("date-time").addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:date and time");
64+
return OASFactory.createObject(Schema.class).addType(SchemaType.STRING).format("date-time").addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:date and time");
6365
case BOOLEAN:
64-
return OASFactory.createObject(Schema.class).type(SchemaType.BOOLEAN).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:boolean");
66+
return OASFactory.createObject(Schema.class).addType(SchemaType.BOOLEAN).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:boolean");
6567
case NUMBER:
66-
return OASFactory.createObject(Schema.class).type(SchemaType.NUMBER).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:number");
68+
return OASFactory.createObject(Schema.class).addType(SchemaType.NUMBER).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:number");
6769
case STRING:
68-
return OASFactory.createObject(Schema.class).type(SchemaType.STRING).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:string");
70+
return OASFactory.createObject(Schema.class).addType(SchemaType.STRING).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:string");
6971
case CONTEXT:
7072
return OASFactory.createObject(Schema.class).addExtension(DMNOASConstants.X_DMN_TYPE, "FEEL:context"); // intentional, do NOT add .type(SchemaType.OBJECT), the JSONSchema to represent FEEL:context is {}
7173
case DURATION:

kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/RangeNodeSchemaMapper.java

+20-6
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,33 @@ static void populateSchemaFromListOfRanges(Schema toPopulate, List<RangeNode> ra
3535
if (range != null) {
3636
if (range.getLowEndPoint() != null) {
3737
if (range.getLowEndPoint() instanceof BigDecimal bigDecimal) {
38-
toPopulate.minimum(bigDecimal);
38+
if (range.getLowBoundary() == Range.RangeBoundary.OPEN){
39+
toPopulate.exclusiveMinimum(bigDecimal);
40+
} else {
41+
toPopulate.minimum(bigDecimal);
42+
}
3943
} else {
40-
toPopulate.addExtension(DMNOASConstants.X_DMN_MINIMUM_VALUE, range.getLowEndPoint());
44+
if (range.getLowBoundary() == Range.RangeBoundary.OPEN){
45+
toPopulate.addExtension(DMNOASConstants.X_DMN_EXCLUSIVE_MINIMUM_VALUE, range.getLowEndPoint());
46+
} else {
47+
toPopulate.addExtension(DMNOASConstants.X_DMN_MINIMUM_VALUE, range.getLowEndPoint());
48+
}
4149
}
42-
toPopulate.exclusiveMinimum(range.getLowBoundary() == Range.RangeBoundary.OPEN);
4350
}
4451
if (range.getHighEndPoint() != null) {
4552
if (range.getHighEndPoint() instanceof BigDecimal bigDecimal) {
46-
toPopulate.maximum(bigDecimal);
53+
if (range.getHighBoundary() == Range.RangeBoundary.OPEN ){
54+
toPopulate.exclusiveMaximum(bigDecimal);
55+
} else {
56+
toPopulate.maximum(bigDecimal);
57+
}
4758
} else {
48-
toPopulate.addExtension(DMNOASConstants.X_DMN_MAXIMUM_VALUE, range.getHighEndPoint());
59+
if (range.getHighBoundary() == Range.RangeBoundary.OPEN){
60+
toPopulate.addExtension(DMNOASConstants.X_DMN_EXCLUSIVE_MAXIMUM_VALUE, range.getHighEndPoint());
61+
} else {
62+
toPopulate.addExtension(DMNOASConstants.X_DMN_MAXIMUM_VALUE, range.getHighEndPoint());
63+
}
4964
}
50-
toPopulate.exclusiveMaximum(range.getHighBoundary() == Range.RangeBoundary.OPEN);
5165
}
5266
}
5367
}

kie-dmn/kie-dmn-openapi/src/test/java/org/kie/dmn/openapi/BaseDMNOASTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
import com.fasterxml.jackson.databind.JsonNode;
2525
import com.fasterxml.jackson.databind.ObjectMapper;
2626
import com.fasterxml.jackson.databind.json.JsonMapper;
27+
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
2728
import com.fasterxml.jackson.databind.node.ObjectNode;
2829
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
2930
import com.networknt.schema.JsonSchema;
3031
import com.networknt.schema.JsonSchemaFactory;
3132
import com.networknt.schema.ValidationMessage;
32-
import io.smallrye.openapi.runtime.io.JsonUtil;
3333
import org.kie.dmn.api.core.DMNModel;
3434
import org.kie.dmn.api.core.DMNRuntime;
3535
import org.kie.dmn.api.core.DMNType;
@@ -71,7 +71,7 @@ protected static ObjectNode synthesizeSchema(DMNOASResult result, DMNModel model
7171
private static ObjectNode synthesizeSchema(DMNOASResult result, DMNType InputSetTypeUT) {
7272
String dollarRef = result.getNamingPolicy().getRef(InputSetTypeUT);
7373
ObjectNode syntheticJSONSchema = result.getJsonSchemaNode().deepCopy();
74-
JsonUtil.stringProperty(syntheticJSONSchema, "$ref", dollarRef);
74+
syntheticJSONSchema.set("$ref", JsonNodeFactory.instance.textNode(dollarRef));
7575
JacksonUtils.printoutJSON(syntheticJSONSchema);
7676
return syntheticJSONSchema;
7777
}

kie-dmn/kie-dmn-openapi/src/test/java/org/kie/dmn/openapi/EnumGenerationTest.java

+13-12
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.kie.dmn.openapi.model.DMNOASResult;
3636

3737
import static org.assertj.core.api.Assertions.assertThat;
38+
import static org.kie.dmn.openapi.impl.DMNOASConstants.X_NULLABLE;
3839

3940
class EnumGenerationTest extends BaseDMNOASTest {
4041

@@ -65,8 +66,8 @@ void numberAllowedValues() {
6566
assertThat(e).isInstanceOf(DecimalNode.class);
6667
assertThat(expected).contains(e.decimalValue());
6768
});
68-
assertThat(node.get("nullable")).isNotNull().isInstanceOf(BooleanNode.class);
69-
assertThat(node.get("nullable").asBoolean()).isFalse();
69+
assertThat(node.get(X_NULLABLE)).isNotNull().isInstanceOf(BooleanNode.class);
70+
assertThat(node.get(X_NULLABLE).asBoolean()).isFalse();
7071
}
7172

7273
@Test
@@ -80,8 +81,8 @@ void stringAllowedValues() {
8081
assertThat(e).isInstanceOf(TextNode.class);
8182
assertThat(expected).contains(e.textValue());
8283
});
83-
assertThat(node.get("nullable")).isNotNull().isInstanceOf(BooleanNode.class);
84-
assertThat(node.get("nullable").asBoolean()).isFalse();
84+
assertThat(node.get(X_NULLABLE)).isNotNull().isInstanceOf(BooleanNode.class);
85+
assertThat(node.get(X_NULLABLE).asBoolean()).isFalse();
8586
}
8687

8788
@Test
@@ -94,8 +95,8 @@ void stringNullableAllowedValues() {
9495
assertThat(arrayNode).allSatisfy(e -> {
9596
assertThat(expected).contains(e.textValue());
9697
});
97-
assertThat(node.get("nullable")).isNotNull().isInstanceOf(BooleanNode.class);
98-
assertThat(node.get("nullable").asBoolean()).isTrue();
98+
assertThat(node.get(X_NULLABLE)).isNotNull().isInstanceOf(BooleanNode.class);
99+
assertThat(node.get(X_NULLABLE).asBoolean()).isTrue();
99100
}
100101

101102
@Test
@@ -109,8 +110,8 @@ void numberTypeConstraint() {
109110
assertThat(e).isInstanceOf(DecimalNode.class);
110111
assertThat(expected).contains(e.decimalValue());
111112
});
112-
assertThat(node.get("nullable")).isNotNull().isInstanceOf(BooleanNode.class);
113-
assertThat(node.get("nullable").asBoolean()).isFalse();
113+
assertThat(node.get(X_NULLABLE)).isNotNull().isInstanceOf(BooleanNode.class);
114+
assertThat(node.get(X_NULLABLE).asBoolean()).isFalse();
114115
}
115116

116117
@Test
@@ -124,8 +125,8 @@ void stringTypeConstraint() {
124125
assertThat(e).isInstanceOf(TextNode.class);
125126
assertThat(expected).contains(e.textValue());
126127
});
127-
assertThat(node.get("nullable")).isNotNull().isInstanceOf(BooleanNode.class);
128-
assertThat(node.get("nullable").asBoolean()).isFalse();
128+
assertThat(node.get(X_NULLABLE)).isNotNull().isInstanceOf(BooleanNode.class);
129+
assertThat(node.get(X_NULLABLE).asBoolean()).isFalse();
129130
}
130131

131132
@Test
@@ -137,7 +138,7 @@ void stringNullableTypeConstraint() {
137138

138139
assertThat(arrayNode).extracting(node1 -> node1.textValue()).containsExactlyInAnyOrder("a", "b", "c", null);
139140

140-
assertThat(node.get("nullable")).isNotNull().isInstanceOf(BooleanNode.class);
141-
assertThat(node.get("nullable").asBoolean()).isTrue();
141+
assertThat(node.get(X_NULLABLE)).isNotNull().isInstanceOf(BooleanNode.class);
142+
assertThat(node.get(X_NULLABLE).asBoolean()).isTrue();
142143
}
143144
}

0 commit comments

Comments
 (0)