syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [3/4] syncope git commit: Fixing OpenAPI quirks on 200 responses not derived from Java when not specified as @ApiResponse
Date Fri, 05 Oct 2018 14:24:12 GMT
Fixing OpenAPI quirks on 200 responses not derived from Java when not specified as @ApiResponse


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/c448befb
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/c448befb
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/c448befb

Branch: refs/heads/master
Commit: c448befbcf37f52bd1a1bd6849bc1503b99b3a7e
Parents: 04f0dcb
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Fri Oct 5 15:35:46 2018 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Fri Oct 5 16:23:56 2018 +0200

----------------------------------------------------------------------
 .../common/rest/api/service/JAXRSService.java   |  21 ---
 .../common/rest/api/service/LoggerService.java  |  36 ----
 .../core/rest/cxf/SyncopeOpenApiCustomizer.java | 169 ++++++++++++++++---
 .../rest/api/service/BpmnProcessService.java    |   8 -
 .../rest/api/service/UserRequestService.java    |  23 ---
 .../api/service/UserWorkflowTaskService.java    |  17 +-
 6 files changed, 153 insertions(+), 121 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/c448befb/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
index ee7d840..f613370 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
@@ -18,27 +18,6 @@
  */
 package org.apache.syncope.common.rest.api.service;
 
-import io.swagger.v3.oas.annotations.headers.Header;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
-import io.swagger.v3.oas.annotations.responses.ApiResponses;
-import org.apache.syncope.common.lib.to.ErrorTO;
-import org.apache.syncope.common.rest.api.RESTHeaders;
-
-@ApiResponses(
-        @ApiResponse(responseCode = "400",
-                description = "An error occurred; HTTP status code can vary depending on
the actual error: "
-                + "400, 403, 404, 409, 412",
-                content =
-                @Content(schema =
-                        @Schema(implementation = ErrorTO.class)),
-                headers = {
-                    @Header(name = RESTHeaders.ERROR_CODE, schema =
-                            @Schema(type = "string"), description = "Error code"),
-                    @Header(name = RESTHeaders.ERROR_INFO, schema =
-                            @Schema(type = "string"), description = "Error message") })
-)
 public interface JAXRSService {
 
     String PARAM_FIQL = "fiql";

http://git-wip-us.apache.org/repos/asf/syncope/blob/c448befb/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
index 262325a..fe8283d 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
@@ -20,8 +20,6 @@ package org.apache.syncope.common.rest.api.service;
 
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.enums.ParameterIn;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-import io.swagger.v3.oas.annotations.media.Content;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
 import io.swagger.v3.oas.annotations.responses.ApiResponses;
@@ -60,13 +58,6 @@ public interface LoggerService extends JAXRSService {
      *
      * @return the list of memory appenders available in the current logging configuration
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200",
-                    description = "list of memory appenders available in the current logging
configuration",
-                    content =
-                    @Content(array =
-                            @ArraySchema(schema =
-                                    @Schema(implementation = LogAppender.class)))))
     @GET
     @Path("memoryAppenders")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
@@ -78,13 +69,6 @@ public interface LoggerService extends JAXRSService {
      * @param memoryAppender memory appender name
      * @return the last log statements available in the provided memory appender
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200",
-                    description = "last log statements available in the provided memory appender",
-                    content =
-                    @Content(array =
-                            @ArraySchema(schema =
-                                    @Schema(implementation = LogStatement.class)))))
     @GET
     @Path("memoryAppenders/{memoryAppender}/lastLogStatements")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
@@ -95,13 +79,6 @@ public interface LoggerService extends JAXRSService {
      *
      * @return list of all managed events in audit
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200",
-                    description = "list of all managed events in audit",
-                    content =
-                    @Content(array =
-                            @ArraySchema(schema =
-                                    @Schema(implementation = EventCategory.class)))))
     @GET
     @Path("events")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
@@ -114,12 +91,6 @@ public interface LoggerService extends JAXRSService {
      * @param name Logger name to be read
      * @return logger with matching type and name
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200",
-                    description = "logger with matching type and name",
-                    content =
-                    @Content(schema =
-                            @Schema(implementation = LoggerTO.class))))
     @GET
     @Path("{type}/{name}")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
@@ -131,13 +102,6 @@ public interface LoggerService extends JAXRSService {
      * @param type LoggerType to be selected
      * @return list of loggers with matching type
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200",
-                    description = "list of loggers with matching type",
-                    content =
-                    @Content(array =
-                            @ArraySchema(schema =
-                                    @Schema(implementation = LoggerTO.class)))))
     @GET
     @Path("{type}")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})

http://git-wip-us.apache.org/repos/asf/syncope/blob/c448befb/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/SyncopeOpenApiCustomizer.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/SyncopeOpenApiCustomizer.java
b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/SyncopeOpenApiCustomizer.java
index 788c12f..c3134b6 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/SyncopeOpenApiCustomizer.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/SyncopeOpenApiCustomizer.java
@@ -18,7 +18,10 @@
  */
 package org.apache.syncope.core.rest.cxf;
 
-import io.swagger.v3.oas.integration.api.OpenAPIConfiguration;
+import io.swagger.v3.jaxrs2.Reader;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.Operation;
+import io.swagger.v3.oas.models.PathItem;
 import io.swagger.v3.oas.models.headers.Header;
 import io.swagger.v3.oas.models.media.Content;
 import io.swagger.v3.oas.models.media.MediaType;
@@ -26,12 +29,21 @@ import io.swagger.v3.oas.models.media.Schema;
 import io.swagger.v3.oas.models.parameters.HeaderParameter;
 import io.swagger.v3.oas.models.parameters.Parameter;
 import io.swagger.v3.oas.models.responses.ApiResponse;
+import io.swagger.v3.oas.models.responses.ApiResponses;
+import io.swagger.v3.oas.models.tags.Tag;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.cxf.jaxrs.model.ClassResourceInfo;
+import org.apache.cxf.jaxrs.model.OperationResourceInfo;
+import org.apache.cxf.jaxrs.model.doc.JavaDocProvider;
 import org.apache.cxf.jaxrs.openapi.OpenApiCustomizer;
 import org.apache.syncope.common.lib.SyncopeConstants;
 import org.apache.syncope.common.lib.to.ErrorTO;
@@ -41,6 +53,15 @@ import org.apache.syncope.core.spring.ApplicationContextProvider;
 
 public class SyncopeOpenApiCustomizer extends OpenApiCustomizer {
 
+    // remove the line below with CXF 3.2.7
+    private JavaDocProvider javadocProvider;
+
+    // remove the line below with CXF 3.2.7
+    private boolean replaceTags;
+
+    // remove the line below with CXF 3.2.7
+    private List<ClassResourceInfo> cris;
+
     private List<String> domains;
 
     public SyncopeOpenApiCustomizer() {
@@ -48,33 +69,93 @@ public class SyncopeOpenApiCustomizer extends OpenApiCustomizer {
 
         URL[] javaDocURLs = JavaDocUtils.getJavaDocURLs();
         if (javaDocURLs != null) {
+            // remove the line below with CXF 3.2.7
+            this.javadocProvider = new JavaDocProvider(javaDocURLs);
             super.setJavaDocURLs(javaDocURLs);
         }
     }
 
     @Override
-    public OpenAPIConfiguration customize(final OpenAPIConfiguration configuration) {
-        Map<String, Header> headers = new LinkedHashMap<>();
-        headers.put(
-                RESTHeaders.ERROR_CODE,
-                new Header().schema(new Schema<>().type("string")).description("Error
code"));
-        headers.put(
-                RESTHeaders.ERROR_INFO,
-                new Header().schema(new Schema<>().type("string")).description("Error
message"));
+    public void setReplaceTags(final boolean replaceTags) {
+        // remove this method with CXF 3.2.7
+        this.replaceTags = replaceTags;
+        super.setReplaceTags(replaceTags);
+    }
 
-        Content content = new Content();
-        content.addMediaType(
-                javax.ws.rs.core.MediaType.APPLICATION_JSON, new MediaType().schema(new Schema<ErrorTO>()));
-        content.addMediaType(
-                javax.ws.rs.core.MediaType.APPLICATION_XML, new MediaType().schema(new Schema<ErrorTO>()));
+    @Override
+    public void setClassResourceInfos(final List<ClassResourceInfo> classResourceInfos)
{
+        // remove this method with CXF 3.2.7
+        this.cris = classResourceInfos;
+        super.setClassResourceInfos(classResourceInfos);
+    }
 
-        configuration.getOpenAPI().getComponents().addResponses("400", new ApiResponse().
-                description("An error occurred; HTTP status code can vary depending on the
actual error: "
-                        + "400, 403, 404, 409, 412").
-                headers(headers).
-                content(content));
+    @Override
+    public void customize(final OpenAPI oas) {
+        // remove this method with CXF 3.2.7
+        if (replaceTags || javadocProvider != null) {
+            Map<String, ClassResourceInfo> operations = new HashMap<>();
+            Map<Pair<String, String>, OperationResourceInfo> methods = new HashMap<>();
+            cris.forEach(cri -> {
+                cri.getMethodDispatcher().getOperationResourceInfos().forEach(ori -> {
+                    String normalizedPath = getNormalizedPath(
+                            cri.getURITemplate().getValue(), ori.getURITemplate().getValue());
+
+                    operations.put(normalizedPath, cri);
+                    methods.put(Pair.of(ori.getHttpMethod(), normalizedPath), ori);
+                });
+            });
+
+            List<Tag> tags = new ArrayList<>();
+            oas.getPaths().forEach((pathKey, pathItem) -> {
+                Tag tag = null;
+                if (replaceTags && operations.containsKey(pathKey)) {
+                    ClassResourceInfo cri = operations.get(pathKey);
+
+                    tag = new Tag();
+                    tag.setName(cri.getURITemplate().getValue().replaceAll("/", "_"));
+                    if (javadocProvider != null) {
+                        tag.setDescription(javadocProvider.getClassDoc(cri));
+                    }
+
+                    if (!tags.contains(tag)) {
+                        tags.add(tag);
+                    }
+                }
+
+                for (Map.Entry<PathItem.HttpMethod, Operation> subentry : pathItem.readOperationsMap().entrySet())
{
+                    if (replaceTags && tag != null) {
+                        subentry.getValue().setTags(Collections.singletonList(tag.getName()));
+                    }
+
+                    Pair<String, String> key = Pair.of(subentry.getKey().name(), pathKey);
+                    if (methods.containsKey(key) && javadocProvider != null) {
+                        OperationResourceInfo ori = methods.get(key);
+
+                        if (StringUtils.isBlank(subentry.getValue().getSummary())) {
+                            subentry.getValue().setSummary(javadocProvider.getMethodDoc(ori));
+                        }
+                        if (subentry.getValue().getParameters() == null) {
+                            List<Parameter> parameters = new ArrayList<>();
+                            addParameters(parameters);
+                            subentry.getValue().setParameters(parameters);
+                        } else {
+                            for (int i = 0; i < subentry.getValue().getParameters().size();
i++) {
+                                if (StringUtils.isBlank(subentry.getValue().getParameters().get(i).getDescription()))
{
+                                    subentry.getValue().getParameters().get(i).
+                                            setDescription(javadocProvider.getMethodParameterDoc(ori,
i));
+                                }
+                            }
+                            addParameters(subentry.getValue().getParameters());
+                        }
 
-        return super.customize(configuration);
+                        customizeResponses(subentry.getValue(), ori);
+                    }
+                }
+            });
+            if (replaceTags && oas.getTags() != null) {
+                oas.setTags(tags);
+            }
+        }
     }
 
     @Override
@@ -102,4 +183,52 @@ public class SyncopeOpenApiCustomizer extends OpenApiCustomizer {
             parameters.add(parameter);
         }
     }
+
+    protected void customizeResponses(final Operation operation, final OperationResourceInfo
ori) {
+        // this will be replaced by super.customizeResponses(operation, ori);
+        if (operation.getResponses() != null && !operation.getResponses().isEmpty())
{
+            ApiResponse response = operation.getResponses().entrySet().iterator().next().getValue();
+            if (StringUtils.isBlank(response.getDescription())
+                    || (StringUtils.isNotBlank(javadocProvider.getMethodResponseDoc(ori))
+                    && Reader.DEFAULT_DESCRIPTION.equals(response.getDescription())))
{
+
+                response.setDescription(javadocProvider.getMethodResponseDoc(ori));
+            }
+        }
+        //
+
+        ApiResponses responses = operation.getResponses();
+        if (responses == null) {
+            responses = new ApiResponses();
+            operation.setResponses(responses);
+        }
+
+        ApiResponse defaultResponse = responses.getDefault();
+        if (defaultResponse != null) {
+            responses.remove(ApiResponses.DEFAULT);
+            responses.addApiResponse("200", defaultResponse);
+        }
+
+        Map<String, Header> headers = new LinkedHashMap<>();
+        headers.put(
+                RESTHeaders.ERROR_CODE,
+                new Header().schema(new Schema<>().type("string")).description("Error
code"));
+        headers.put(
+                RESTHeaders.ERROR_INFO,
+                new Header().schema(new Schema<>().type("string")).description("Error
message"));
+
+        Content content = new Content();
+        content.addMediaType(
+                javax.ws.rs.core.MediaType.APPLICATION_JSON, new MediaType().schema(new Schema<ErrorTO>()));
+        content.addMediaType(
+                RESTHeaders.APPLICATION_YAML, new MediaType().schema(new Schema<ErrorTO>()));
+        content.addMediaType(
+                javax.ws.rs.core.MediaType.APPLICATION_XML, new MediaType().schema(new Schema<ErrorTO>()));
+
+        responses.addApiResponse("400", new ApiResponse().
+                description("An error occurred; HTTP status code can vary depending on the
actual error: "
+                        + "400, 403, 404, 409, 412").
+                headers(headers).
+                content(content));
+    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/c448befb/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/BpmnProcessService.java
----------------------------------------------------------------------
diff --git a/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/BpmnProcessService.java
b/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/BpmnProcessService.java
index bb34fdd..fcf0220 100644
--- a/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/BpmnProcessService.java
+++ b/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/BpmnProcessService.java
@@ -19,9 +19,6 @@
 package org.apache.syncope.common.rest.api.service;
 
 import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
 import io.swagger.v3.oas.annotations.responses.ApiResponses;
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -56,11 +53,6 @@ public interface BpmnProcessService extends JAXRSService {
      *
      * @return available BPMN processs
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200", description = "available BPMN processes",
content =
-                    @Content(array =
-                            @ArraySchema(schema =
-                                    @Schema(implementation = BpmnProcess.class)))))
     @GET
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
     List<BpmnProcess> list();

http://git-wip-us.apache.org/repos/asf/syncope/blob/c448befb/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserRequestService.java
----------------------------------------------------------------------
diff --git a/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserRequestService.java
b/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserRequestService.java
index 5ad7b12..11aac50 100644
--- a/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserRequestService.java
+++ b/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserRequestService.java
@@ -18,8 +18,6 @@
  */
 package org.apache.syncope.common.rest.api.service;
 
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
 import io.swagger.v3.oas.annotations.responses.ApiResponses;
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -60,10 +58,6 @@ public interface UserRequestService extends JAXRSService {
      * @param query query conditions
      * @return list of all running user requests
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200", description = "list of all running user requests",
content =
-                    @Content(schema =
-                            @Schema(implementation = PagedResult.class))))
     @GET
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
     PagedResult<UserRequest> list(@BeanParam UserRequestQuery query);
@@ -75,11 +69,6 @@ public interface UserRequestService extends JAXRSService {
      * @param user if value looks like a UUID then it is interpreted as key otherwise as
a username
      * @return data about the started request service, including execution id
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200",
-                    description = "data about the started request service, including execution
id", content =
-                    @Content(schema =
-                            @Schema(implementation = UserRequest.class))))
     @POST
     @Path("start/{bpmnProcess}")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
@@ -108,10 +97,6 @@ public interface UserRequestService extends JAXRSService {
      * @param query query conditions
      * @return list of all available user request forms
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200", description = "list of all available user
request forms", content =
-                    @Content(schema =
-                            @Schema(implementation = PagedResult.class))))
     @GET
     @Path("forms")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
@@ -123,10 +108,6 @@ public interface UserRequestService extends JAXRSService {
      * @param taskId workflow task id
      * @return the form for the given task id
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200", description = "the form for the given task
id", content =
-                    @Content(schema =
-                            @Schema(implementation = UserRequestForm.class))))
     @POST
     @Path("forms/{taskId}/claim")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
@@ -138,10 +119,6 @@ public interface UserRequestService extends JAXRSService {
      * @param form user request form.
      * @return updated user
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200", description = "updated user", content =
-                    @Content(schema =
-                            @Schema(implementation = UserTO.class))))
     @POST
     @Path("forms")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})

http://git-wip-us.apache.org/repos/asf/syncope/blob/c448befb/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowTaskService.java
----------------------------------------------------------------------
diff --git a/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowTaskService.java
b/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowTaskService.java
index b396d6e..f379eca 100644
--- a/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowTaskService.java
+++ b/ext/flowable/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/UserWorkflowTaskService.java
@@ -18,11 +18,9 @@
  */
 package org.apache.syncope.common.rest.api.service;
 
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
 import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
-import io.swagger.v3.oas.annotations.responses.ApiResponses;
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
 import io.swagger.v3.oas.annotations.security.SecurityRequirements;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -53,11 +51,6 @@ public interface UserWorkflowTaskService extends JAXRSService {
      * @param userKey user key
      * @return list of available tasks for the given user key
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200", description = "list of available tasks for
the given user key", content =
-                    @Content(array =
-                            @ArraySchema(schema =
-                                    @Schema(implementation = WorkflowTask.class)))))
     @GET
     @Path("tasks/{userKey}")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})
@@ -69,10 +62,8 @@ public interface UserWorkflowTaskService extends JAXRSService {
      * @param workflowTaskExecInput input for task execution
      * @return updated user
      */
-    @ApiResponses(
-            @ApiResponse(responseCode = "200", description = "updated user", content =
-                    @Content(schema =
-                            @Schema(implementation = UserTO.class))))
+    @Parameter(name = "userKey", description = "user key", in = ParameterIn.PATH, schema
=
+            @Schema(type = "string"))
     @POST
     @Path("tasks/{userKey}")
     @Produces({ MediaType.APPLICATION_JSON, RESTHeaders.APPLICATION_YAML, MediaType.APPLICATION_XML
})


Mime
View raw message