From 18f12d03a9f4094bf2caa573339c8797c018374b Mon Sep 17 00:00:00 2001 From: Marco Miller Date: Thu, 3 Mar 2022 14:03:44 -0500 Subject: [PATCH] server: Add consistent swagger doc for service 405 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 Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/191418 Tested-by: Trace Compass Bot Tested-by: Matthew Khouzam Reviewed-by: Matthew Khouzam --- .../core/services/DataProviderService.java | 31 ++++++++++++------- .../rest/core/services/EndpointConstants.java | 1 - 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.java b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.java index 2cb3c3309..a29394275 100644 --- a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.java +++ b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/DataProviderService.java @@ -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; @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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, @@ -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( @@ -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, diff --git a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/EndpointConstants.java b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/EndpointConstants.java index 47723baac..bcea7f558 100644 --- a/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/EndpointConstants.java +++ b/trace-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core/src/org/eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/EndpointConstants.java @@ -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$