This is an automated email from the ASF dual-hosted git repository.
yamer pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git
The following commit(s) were added to refs/heads/main by this push:
new 2abca23bdc [kie-issues#2141] Improve OpenAPI v3 spec endpoints (#6484)
2abca23bdc is described below
commit 2abca23bdcec329bb0457ed2bd279c771144f4fd
Author: Yeser Amer <[email protected]>
AuthorDate: Tue Oct 21 12:32:40 2025 +0200
[kie-issues#2141] Improve OpenAPI v3 spec endpoints (#6484)
* OpenAPI v3 metadata updated.
* OpenAPI v3 metadata updated.
* OpenAPI v3 metadata updated.
* Keep version in sync
* Keep version in sync
---
build-parent/pom.xml | 40 ++--------------------
.../execmodel/RuleUnitQueryEndpointWriter.java | 3 +-
.../ruleunits/RestQueryQuarkusTemplate.java | 8 +++++
.../ruleunits/RestQuerySpringTemplate.java | 15 ++++++--
.../pom.xml | 4 +++
5 files changed, 28 insertions(+), 42 deletions(-)
diff --git a/build-parent/pom.xml b/build-parent/pom.xml
index 9e8a65f545..8801d7fa15 100644
--- a/build-parent/pom.xml
+++ b/build-parent/pom.xml
@@ -138,10 +138,8 @@
<version.org.antlr4>4.13.2</version.org.antlr4>
<version.org.jboss.arquillian.selenium>3.13.0</version.org.jboss.arquillian.selenium>
- <version.io.swagger>1.6.2</version.io.swagger>
- <version.io.swagger.core.v3>2.2.19</version.io.swagger.core.v3>
- <version.io.swagger.parser.v3>2.1.19</version.io.swagger.parser.v3>
-
<version.io.swagger.swagger-parser>1.0.55</version.io.swagger.swagger-parser>
+ <version.io.swagger.core.v3>2.2.38</version.io.swagger.core.v3>
+ <version.io.swagger.parser.v3>2.1.34</version.io.swagger.parser.v3>
<version.org.xmlunit>2.10.4</version.org.xmlunit>
<!-- therefore the property is rewritten in that repository parent -->
<version.org.asciidoctor.asciidoctorj>2.2.0</version.org.asciidoctor.asciidoctorj>
@@ -1066,33 +1064,6 @@
<classifier>runtime</classifier>
</dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-core</artifactId>
- <version>${version.io.swagger}</version>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jaxrs</artifactId>
- <version>${version.io.swagger}</version>
- <exclusions>
- <exclusion>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-annotations</artifactId>
- <version>${version.io.swagger}</version>
- </dependency>
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-models</artifactId>
- <version>${version.io.swagger}</version>
- </dependency>
-
<!-- OAS v3 -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
@@ -1116,13 +1087,6 @@
</exclusions>
</dependency>
- <!-- swagger parser -->
- <dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-parser</artifactId>
- <version>${version.io.swagger.swagger-parser}</version>
- </dependency>
-
<dependency>
<groupId>org.jboss.narayana.jta</groupId>
<artifactId>narayana-jta</artifactId>
diff --git
a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryEndpointWriter.java
b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryEndpointWriter.java
index 2e777153f9..4920fd6e89 100644
---
a/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryEndpointWriter.java
+++
b/drools-model/drools-model-codegen/src/main/java/org/drools/model/codegen/execmodel/RuleUnitQueryEndpointWriter.java
@@ -191,7 +191,8 @@ public class RuleUnitQueryEndpointWriter {
.replace("$name$", queryName)
.replace("$endpointName$", endpointName)
.replace("$queryName$", query.model().getName())
- .replace("$prometheusName$", endpointName);
+ .replace("$prometheusName$", endpointName)
+ .replace("$modelName$", query.model().getName());
vv.setString(interpolated);
}
diff --git
a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryQuarkusTemplate.java
b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryQuarkusTemplate.java
index 7780623f58..ce4acb8aa9 100644
---
a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryQuarkusTemplate.java
+++
b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQueryQuarkusTemplate.java
@@ -25,11 +25,15 @@ import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
+import org.eclipse.microprofile.openapi.annotations.Operation;
+import org.eclipse.microprofile.openapi.annotations.tags.Tag;
+
import org.drools.ruleunits.api.RuleUnit;
import org.drools.ruleunits.api.RuleUnitInstance;
import static java.util.stream.Collectors.toList;
@Path("/$endpointName$")
+@Tag(name = "Rules - $modelName$")
public class $unit$Query$name$Endpoint {
@jakarta.inject.Inject
@@ -44,6 +48,8 @@ public class $unit$Query$name$Endpoint {
@POST()
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
+ @Operation(operationId ="executeRuleQuery_$modelName$",
+ summary="It executes the $modelName$ Rule Query")
public List<$ReturnType$> executeQuery($UnitTypeDTO$ unitDTO) {
RuleUnitInstance<$UnitType$> instance = ruleUnit.createInstance();
// Do not return the result directly to allow post execution codegen
(like monitoring)
@@ -56,6 +62,8 @@ public class $unit$Query$name$Endpoint {
@Path("/first")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
+ @Operation(operationId ="executeRuleQuerySingleResult_$modelName$",
+ summary="It executes the $modelName$ Rule Query. It returns one
single fact (the first) as a result.")
public $ReturnType$ executeQueryFirst($UnitTypeDTO$ unitDTO) {
List<$ReturnType$> results = executeQuery(unitDTO);
$ReturnType$ response = results.isEmpty() ? null : results.get(0);
diff --git
a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQuerySpringTemplate.java
b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQuerySpringTemplate.java
index 0fcf280697..5aafdc36f9 100644
---
a/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQuerySpringTemplate.java
+++
b/drools-model/drools-model-codegen/src/main/resources/class-templates/ruleunits/RestQuerySpringTemplate.java
@@ -26,12 +26,16 @@ import
org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+
import org.drools.ruleunits.api.RuleUnit;
import org.drools.ruleunits.api.RuleUnitInstance;
import static java.util.stream.Collectors.toList;
@RestController
@RequestMapping("/$endpointName$")
+@Tag(name = "Rules - $modelName$")
public class $unit$Query$name$Endpoint {
@Autowired
@@ -43,7 +47,10 @@ public class $unit$Query$name$Endpoint {
this.ruleUnit = ruleUnit;
}
- @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE, consumes =
MediaType.APPLICATION_JSON_VALUE)
+ @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE,
+ consumes = MediaType.APPLICATION_JSON_VALUE)
+ @Operation(operationId ="executeRuleQuery_$modelName$",
+ summary="It executes the $modelName$ Rule Query")
public List<$ReturnType$> executeQuery(@RequestBody(required = true)
$UnitTypeDTO$ unitDTO) {
RuleUnitInstance<$UnitType$> instance = ruleUnit.createInstance();
// Do not return the result directly to allow post execution codegen
(like monitoring)
@@ -52,8 +59,10 @@ public class $unit$Query$name$Endpoint {
return response;
}
- @PostMapping(value = "/first", produces =
MediaType.APPLICATION_JSON_VALUE, consumes =
- MediaType.APPLICATION_JSON_VALUE)
+ @PostMapping(value = "/first", produces = MediaType.APPLICATION_JSON_VALUE,
+ consumes = MediaType.APPLICATION_JSON_VALUE)
+ @Operation(operationId ="executeRuleQuerySingleResult-$modelName$",
+ summary="It executes the $modelName$ Rule Query. It returns one
single fact (the first) as a result.")
public $ReturnType$ executeQueryFirst(@RequestBody(required = true)
$UnitTypeDTO$ unitDTO) {
List<$ReturnType$> results = executeQuery(unitDTO);
$ReturnType$ response = results.isEmpty() ? null : results.get(0);
diff --git
a/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/pom.xml
b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/pom.xml
index e1e1a79e83..9b4721b781 100644
--- a/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/pom.xml
+++ b/drools-quarkus-extension/drools-quarkus-ruleunit-integration-test/pom.xml
@@ -58,6 +58,10 @@
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-smallrye-openapi</artifactId>
+ </dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]