Skip to content

Commit

Permalink
server: Add missing swagger doc for 404 responses
Browse files Browse the repository at this point in the history
As some of those were already provisioned. Add the missing 404 swagger
response descriptions, completing them all. The other services classes
have theirs consistently already.

Align previously inconsistent use of NO_SUCH_TRACE by replacing these
with PROVIDER_NOT_FOUND, consistently with every other similar 404
case in DataProviderService. Do so for the related swagger descriptions,
while adding entity(NO_SUCH_TRACE) wherever missing, consistently with
every similar case in DataProviderService.

Change-Id: I175eb95c20ed598e8c86ed24e90b73986219ce06
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/191417
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 066480a commit bb19943
Showing 1 changed file with 12 additions and 8 deletions.
Expand Up @@ -225,12 +225,12 @@ public class DataProviderService {
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "Get the list of outputs for this experiment", responses = {
@ApiResponse(responseCode = "200", description = "Returns a list of output provider descriptors", content = @Content(array = @ArraySchema(schema = @Schema(implementation = IDataProvider.class)))),
@ApiResponse(responseCode = "404", description = NO_SUCH_TRACE, content = @Content(schema = @Schema(implementation = String.class)))
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getProviders(@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID) {
TmfExperiment experiment = ExperimentManagerService.getExperimentByUUID(expUUID);
if (experiment == null) {
return Response.status(Status.NOT_FOUND).build();
return Response.status(Status.NOT_FOUND).entity(NO_SUCH_TRACE).build();
}
List<IDataProviderDescriptor> list = DataProviderManager.getInstance().getAvailableProviders(experiment);
list.addAll(getXmlDataProviderDescriptors(experiment, EnumSet.of(OutputType.TIME_GRAPH)));
Expand Down Expand Up @@ -267,7 +267,7 @@ public Response getProvider(
@Parameter(description = OUTPUT_ID) @PathParam("outputId") String outputId) {
TmfExperiment experiment = ExperimentManagerService.getExperimentByUUID(expUUID);
if (experiment == null) {
return Response.status(Status.NOT_FOUND).build();
return Response.status(Status.NOT_FOUND).entity(NO_SUCH_TRACE).build();
}
List<IDataProviderDescriptor> list = DataProviderManager.getInstance().getAvailableProviders(experiment);
list.addAll(getXmlDataProviderDescriptors(experiment, EnumSet.of(OutputType.TIME_GRAPH)));
Expand Down Expand Up @@ -335,7 +335,7 @@ public Response getXYTree(
"ensures that the same template is followed for all endpoints.", responses = {
@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 = NO_SUCH_TRACE, 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)))
})
public Response getXY(
Expand Down Expand Up @@ -572,7 +572,8 @@ public Response getArrows(
@Tag(name = ANN)
@Produces(MediaType.APPLICATION_JSON)
@Operation(summary = "API to get marker sets available for this experiment", responses = {
@ApiResponse(responseCode = "200", description = "List of marker sets", content = @Content(schema = @Schema(implementation = IMarkerSetsResponse.class)))
@ApiResponse(responseCode = "200", description = "List of marker sets", content = @Content(schema = @Schema(implementation = IMarkerSetsResponse.class))),
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = String.class)))
})
public Response getMarkerSets(@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID) {

Expand Down Expand Up @@ -602,7 +603,8 @@ public Response getMarkerSets(@Parameter(description = EXP_UUID) @PathParam("exp
@Produces(MediaType.APPLICATION_JSON)
@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 = "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)))
})
public Response getAnnotationCategories(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -678,7 +680,8 @@ public Response getAnnotationCategories(
@Produces(MediaType.APPLICATION_JSON)
@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 = "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)))
})
public Response getAnnotations(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down Expand Up @@ -1040,7 +1043,8 @@ private Response getTree(UUID expUUID, String outputId, QueryParameters queryPar
@Produces(MediaType.APPLICATION_JSON)
@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 = "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)))
})
public Response getStyles(
@Parameter(description = EXP_UUID) @PathParam("expUUID") UUID expUUID,
Expand Down

0 comments on commit bb19943

Please sign in to comment.