Skip to content

Commit

Permalink
server: Add consistent swagger doc for service 405
Browse files Browse the repository at this point in the history
Add 405 swagger response descriptions to every service (here only
DataProviderService) method. Stick to the already provisioned
NO_PROVIDER short description for this current matter at hand.

Replace the sole use of the slightly differing ANALYSIS_NOT_POSSIBLE
short description with NO_PROVIDER's. Do so consistently with every
other 405 occurrence.

Change-Id: I9ce3d1a92e32662ba49f46129b3d13bcb1552572
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/191418
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
  • Loading branch information
marco-miller authored and MatthewKhouzam committed Mar 11, 2022
1 parent bb19943 commit 18f12d0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
Expand Up @@ -11,7 +11,6 @@

package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services;

import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.ANALYSIS_NOT_POSSIBLE;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.ANN;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.COLUMNS;
import static org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services.EndpointConstants.COLUMNS_EX;
Expand Down Expand Up @@ -303,7 +302,8 @@ public Response getProvider(
@ApiResponse(responseCode = "200", description = "Returns a list of XY entries. " +
CONSISTENT_PARENT, content = @Content(schema = @Schema(implementation = IXYTreeResponse.class))),
@ApiResponse(responseCode = "400", description = INVALID_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getXYTree(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -336,7 +336,7 @@ public Response getXYTree(
@ApiResponse(responseCode = "200", description = "Return the queried XYResponse", content = @Content(schema = @Schema(implementation = IXYResponse.class))),
@ApiResponse(responseCode = "400", description = MISSING_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = ANALYSIS_NOT_POSSIBLE, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getXY(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -431,7 +431,8 @@ public Response getXYTooltip(@PathParam("expUUID") UUID expUUID,
@ApiResponse(responseCode = "200", description = "Returns a list of Time Graph entries. " +
CONSISTENT_PARENT, content = @Content(schema = @Schema(implementation = ITimeGraphTreeResponse.class))),
@ApiResponse(responseCode = "400", description = INVALID_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getTimeGraphTree(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -463,7 +464,8 @@ public Response getTimeGraphTree(
@Operation(summary = "API to get the Time Graph states", description = "Unique entry point for all TimeGraph states, ensures that the same template is followed for all views", responses = {
@ApiResponse(responseCode = "200", description = "Returns a list of time graph rows", content = @Content(schema = @Schema(implementation = ITimeGraphStatesResponse.class))),
@ApiResponse(responseCode = "400", description = MISSING_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getStates(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -522,7 +524,8 @@ public Response getStates(
"ensures that the same template is followed for all models", responses = {
@ApiResponse(responseCode = "200", description = "Returns a sampled list of TimeGraph arrows", content = @Content(schema = @Schema(implementation = ITimeGraphArrowsResponse.class))),
@ApiResponse(responseCode = "400", description = MISSING_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getArrows(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -604,7 +607,8 @@ public Response getMarkerSets(@Parameter(description = EXP_UUID) @PathParam("exp
@Operation(summary = "API to get annotation categories associated to this experiment and output", responses = {
@ApiResponse(responseCode = "200", description = "Annotation categories", content = @Content(schema = @Schema(implementation = IAnnotationCategoriesResponse.class))),
@ApiResponse(responseCode = "400", description = MISSING_OUTPUTID, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getAnnotationCategories(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -681,7 +685,8 @@ public Response getAnnotationCategories(
@Operation(summary = "API to get the annotations associated to this experiment and output", responses = {
@ApiResponse(responseCode = "200", description = "Annotation", content = @Content(schema = @Schema(implementation = IAnnotationResponse.class))),
@ApiResponse(responseCode = "400", description = MISSING_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getAnnotations(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -770,7 +775,8 @@ public Response getAnnotations(
@Operation(summary = "API to get a Time Graph tooltip", description = "Endpoint to retrieve tooltips for time graph", responses = {
@ApiResponse(responseCode = "200", description = "Returns a list of tooltip keys to values", content = @Content(schema = @Schema(implementation = ITimeGraphTooltipResponse.class))),
@ApiResponse(responseCode = "400", description = MISSING_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getTimeGraphTooltip(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -836,7 +842,8 @@ public Response getTimeGraphTooltip(
"to get the column entries", responses = {
@ApiResponse(responseCode = "200", description = "Returns a list of table headers", content = @Content(schema = @Schema(implementation = ITableColumnHeadersResponse.class))),
@ApiResponse(responseCode = "400", description = INVALID_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getColumns(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -883,6 +890,7 @@ public Response getColumns(
@ApiResponse(responseCode = "200", description = "Returns a table model with a 2D array of strings and metadata", content = @Content(schema = @Schema(implementation = IVirtualTableResponse.class))),
@ApiResponse(responseCode = "400", description = INVALID_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "500", description = "Error reading the experiment", content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getLines(
Expand Down Expand Up @@ -1044,7 +1052,8 @@ private Response getTree(UUID expUUID, String outputId, QueryParameters queryPar
@Operation(summary = "API to get the style map associated to this experiment and output", responses = {
@ApiResponse(responseCode = "200", description = "Style model that can be used jointly with OutputElementStyle to retrieve specific style values", content = @Content(schema = @Schema(implementation = IStylesResponse.class))),
@ApiResponse(responseCode = "400", description = MISSING_PARAMETERS, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class))),
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getStyles(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down
Expand Up @@ -132,7 +132,6 @@ public class EndpointConstants {
static final String TIMES_EX_TT = "\"" + REQUESTED_TIME_KEY + "\": [111200000],"; //$NON-NLS-1$ //$NON-NLS-2$

/** Swagger @ApiResponse description constants reused, or centralized. */
static final String ANALYSIS_NOT_POSSIBLE = "Analysis not possible for this trace"; //$NON-NLS-1$
static final String CANNOT_READ = "Cannot read this trace type"; //$NON-NLS-1$
static final String CONSISTENT_PARENT = "The returned model must be consistent, parentIds must refer to a parent which exists in the model."; //$NON-NLS-1$
static final String NAME_EXISTS = "There was already a trace with this name"; //$NON-NLS-1$
Expand Down

0 comments on commit 18f12d0

Please sign in to comment.