Skip to content

Commit e14e8bb

Browse files
fjtiradogmunozfe
authored andcommitted
[Fix apache#4125] Avoid duplicate titles on schema (apache#4134)
Also fixes apache#4124 and apache#4123 Signed-off-by: fjtirado <[email protected]>
1 parent a24e197 commit e14e8bb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

kogito-codegen-modules/kogito-codegen-processes/src/main/resources/class-templates/RestResourceQuarkusTemplate.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646

4747
import org.eclipse.microprofile.openapi.annotations.Operation;
4848
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
49+
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
50+
import org.eclipse.microprofile.openapi.annotations.media.Content;
51+
import org.eclipse.microprofile.openapi.annotations.media.Schema;
52+
4953
import org.jbpm.util.JsonSchemaUtil;
5054
import org.kie.kogito.process.Process;
5155
import org.kie.kogito.process.ProcessInstance;
@@ -55,6 +59,7 @@
5559
import org.kie.kogito.auth.SecurityPolicy;
5660

5761
@Path("/$name$")
62+
@Tag(name = "Process - $name$", description = "$documentation$")
5863
public class $Type$Resource {
5964

6065
Process<$Type$> process;
@@ -68,7 +73,9 @@ public class $Type$Resource {
6873
@POST
6974
@Produces(MediaType.APPLICATION_JSON)
7075
@Consumes(MediaType.APPLICATION_JSON)
71-
@Operation(summary = "$documentation$", description = "$processInstanceDescription$")
76+
@Operation(operationId = "createProcessInstance_$name$", summary = "$documentation$", description = "$processInstanceDescription$")
77+
@APIResponse(responseCode = "400", description = "Bad param")
78+
@APIResponse(responseCode = "201", description = "Process instance created", content={@Content(schema=@Schema(implementation=$Type$Output.class))})
7279
public Response createResource_$name$(@Context HttpHeaders httpHeaders,
7380
@Context UriInfo uriInfo,
7481
@QueryParam("businessKey") @DefaultValue("") String businessKey,

quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/serverless/workflow/parser/schema/OpenApiModelSchemaGenerator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ private static boolean useTitle() {
9696
}
9797

9898
private static Schema createOutputSchema(Schema schema) {
99-
return OASFactory.createSchema().addProperty("workflowdata", schema).addProperty("id", ID_SCHEMA).title(schema.getTitle());
99+
String schemaTitle = schema.getTitle();
100+
schema.setTitle(schemaTitle + "_workflowdata");
101+
return OASFactory.createSchema().addProperty("workflowdata", schema).addProperty("id", ID_SCHEMA).title(schemaTitle);
100102
}
101103

102104
public static void mergeSchemas(OpenAPI targetSchema, Map<String, Schema> schemas, Map<String, Schema> defsSchemas) {

0 commit comments

Comments
 (0)