You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by ji...@apache.org on 2020/05/22 03:05:16 UTC

[submarine] branch master updated: SUBMARINE-505. Change job API response class in swagger annotation

This is an automated email from the ASF dual-hosted git repository.

jiwq pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 20f4718  SUBMARINE-505. Change job API response class in swagger annotation
20f4718 is described below

commit 20f4718e4dacc87eb6de336034112fc774853022
Author: pingsutw <pi...@gmail.com>
AuthorDate: Thu May 21 14:18:38 2020 +0800

    SUBMARINE-505. Change job API response class in swagger annotation
    
    ### What is this PR for?
    The response class should be JsonResponse.class
    
    ### What type of PR is it?
    [Bug Fix]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-505
    
    ### How should this be tested?
    https://travis-ci.org/github/pingsutw/hadoop-submarine/builds/689535458
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: pingsutw <pi...@gmail.com>
    
    Closes #294 from pingsutw/SUBMARINE-505 and squashes the following commits:
    
    1c8a90b [pingsutw] SUBMARINE-505. Change job API response class in swagger annotation
---
 .../submarine/server/rest/JobManagerRestApi.java   | 24 ++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/submarine-server/server-core/src/main/java/org/apache/submarine/server/rest/JobManagerRestApi.java b/submarine-server/server-core/src/main/java/org/apache/submarine/server/rest/JobManagerRestApi.java
index 14e7ca9..ba3ae07 100644
--- a/submarine-server/server-core/src/main/java/org/apache/submarine/server/rest/JobManagerRestApi.java
+++ b/submarine-server/server-core/src/main/java/org/apache/submarine/server/rest/JobManagerRestApi.java
@@ -62,7 +62,8 @@ public class JobManagerRestApi {
           tags = {"jobs"},
           description = "Return the Pong message for test the connectivity",
           responses = {
-                  @ApiResponse(responseCode = "200", description = "successful operation")})
+                  @ApiResponse(responseCode = "200", description = "successful operation",
+                          content = @Content(schema = @Schema(implementation = String.class)))})
   public Response ping() {
     return new JsonResponse.Builder<String>(Response.Status.OK)
         .success(true).result("Pong").build();
@@ -79,7 +80,7 @@ public class JobManagerRestApi {
           tags = {"jobs"},
           responses = {
                   @ApiResponse(description = "successful operation", content = @Content(
-                          schema = @Schema(implementation = Job.class)))})
+                          schema = @Schema(implementation = JsonResponse.class)))})
   public Response createJob(JobSpec spec) {
     try {
       Job job = jobManager.createJob(spec);
@@ -98,7 +99,7 @@ public class JobManagerRestApi {
           tags = {"jobs"},
           responses = {
                   @ApiResponse(description = "successful operation", content = @Content(
-                          schema = @Schema(implementation = Job.class)))})
+                          schema = @Schema(implementation = JsonResponse.class)))})
   public Response listJob(@QueryParam("status") String status) {
     try {
       List<Job> jobList = jobManager.listJobsByStatus(status);
@@ -119,7 +120,7 @@ public class JobManagerRestApi {
           tags = {"jobs"},
           responses = {
                   @ApiResponse(description = "successful operation", content = @Content(
-                          schema = @Schema(implementation = Job.class))),
+                          schema = @Schema(implementation = JsonResponse.class))),
                   @ApiResponse(responseCode = "404", description = "Job not found")})
   public Response getJob(@PathParam(RestConstants.JOB_ID) String id) {
     try {
@@ -137,7 +138,7 @@ public class JobManagerRestApi {
           tags = {"jobs"},
           responses = {
                   @ApiResponse(description = "successful operation", content = @Content(
-                          schema = @Schema(implementation = Job.class))),
+                          schema = @Schema(implementation = JsonResponse.class))),
                   @ApiResponse(responseCode = "404", description = "Job not found")})
   public Response patchJob(@PathParam(RestConstants.JOB_ID) String id, JobSpec spec) {
     try {
@@ -160,7 +161,7 @@ public class JobManagerRestApi {
           tags = {"jobs"},
           responses = {
                   @ApiResponse(description = "successful operation", content = @Content(
-                          schema = @Schema(implementation = Job.class))),
+                          schema = @Schema(implementation = JsonResponse.class))),
                   @ApiResponse(responseCode = "404", description = "Job not found")})
   public Response deleteJob(@PathParam(RestConstants.JOB_ID) String id) {
     try {
@@ -174,6 +175,11 @@ public class JobManagerRestApi {
 
   @GET
   @Path("/logs")
+  @Operation(summary = "Log jobs",
+          tags = {"jobs"},
+          responses = {
+                  @ApiResponse(description = "successful operation", content = @Content(
+                          schema = @Schema(implementation = JsonResponse.class)))})
   public Response listLog(@QueryParam("status") String status) {
     try {
       List<JobLog> jobLogList = jobManager.listJobLogsByStatus(status);
@@ -187,6 +193,12 @@ public class JobManagerRestApi {
 
   @GET
   @Path("/logs/{id}")
+  @Operation(summary = "Log job by id",
+          tags = {"jobs"},
+          responses = {
+                  @ApiResponse(description = "successful operation", content = @Content(
+                          schema = @Schema(implementation = JsonResponse.class))),
+                  @ApiResponse(responseCode = "404", description = "Job not found")})
   public Response getLog(@PathParam(RestConstants.JOB_ID) String id) {
     try {
       JobLog jobLog = jobManager.getJobLog(id);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org