Skip to content

Commit 47a9151

Browse files
committed
swagger: Return DataTreeResponse instead of XYTreeResponse
The endpoint to fetch data tree swagger definition returned the XYTreeResponse and related data structures. This commit corrects the swagger definition for that. Contributes to fixing of trace server protocol ticket: eclipse-cdt-cloud/trace-server-protocol#128 Signed-off-by: Bernd Hufmann <[email protected]>
1 parent c995e3e commit 47a9151

File tree

4 files changed

+86
-1
lines changed

4 files changed

+86
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**********************************************************************
2+
* Copyright (c) 2025 Ericsson
3+
*
4+
* All rights reserved. This program and the accompanying materials are
5+
* made available under the terms of the Eclipse Public License 2.0 which
6+
* accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
**********************************************************************/
11+
12+
package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model;
13+
14+
import io.swagger.v3.oas.annotations.media.Schema;
15+
16+
/**
17+
* Contributes to the model used for TSP swagger-core annotations.
18+
*/
19+
@Schema(allOf = TreeDataModel.class)
20+
public interface DataTreeEntry {
21+
// Place holder data structure
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**********************************************************************
2+
* Copyright (c) 2025 Ericsson
3+
*
4+
* All rights reserved. This program and the accompanying materials are
5+
* made available under the terms of the Eclipse Public License 2.0 which
6+
* accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
**********************************************************************/
11+
12+
package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model;
13+
14+
import java.util.List;
15+
16+
import org.eclipse.jdt.annotation.NonNull;
17+
18+
import io.swagger.v3.oas.annotations.media.Schema;
19+
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
20+
21+
/**
22+
* Contributes to the model used for TSP swagger-core annotations.
23+
*/
24+
@Schema(allOf = TreeEntryModel.class)
25+
public interface DataTreeEntryModel {
26+
27+
/**
28+
* @return The data tree entries.
29+
*/
30+
@NonNull
31+
@Schema(requiredMode = RequiredMode.REQUIRED)
32+
List<@NonNull DataTreeEntry> getEntries();
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**********************************************************************
2+
* Copyright (c) 2025 Ericsson
3+
*
4+
* All rights reserved. This program and the accompanying materials are
5+
* made available under the terms of the Eclipse Public License 2.0 which
6+
* accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
**********************************************************************/
11+
12+
package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model;
13+
14+
import org.eclipse.jdt.annotation.Nullable;
15+
16+
import io.swagger.v3.oas.annotations.media.Schema;
17+
18+
/**
19+
* Contributes to the model used for TSP swagger-core annotations.
20+
*/
21+
@Schema(allOf = GenericResponse.class)
22+
public interface DataTreeResponse {
23+
24+
/**
25+
* @return The model.
26+
*/
27+
@Nullable
28+
DataTreeEntryModel getModel();
29+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.AnnotationsQueryParameters;
112112
import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.ArrowsQueryParameters;
113113
import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.DataProvider;
114+
import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.DataTreeResponse;
114115
import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.ErrorResponse;
115116
import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.GenericXYQueryParameters;
116117
import org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model.LinesQueryParameters;
@@ -306,7 +307,7 @@ public Response getProvider(
306307
@Produces(MediaType.APPLICATION_JSON)
307308
@Operation(summary = "API to get the data tree", description = TREE_ENTRIES, responses = {
308309
@ApiResponse(responseCode = "200", description = "Returns a list of data tree entries. " +
309-
CONSISTENT_PARENT, content = @Content(schema = @Schema(implementation = XYTreeResponse.class))),
310+
CONSISTENT_PARENT, content = @Content(schema = @Schema(implementation = DataTreeResponse.class))),
310311
@ApiResponse(responseCode = "400", description = INVALID_PARAMETERS, content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
311312
@ApiResponse(responseCode = "404", description = PROVIDER_NOT_FOUND, content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
312313
@ApiResponse(responseCode = "405", description = NO_PROVIDER, content = @Content(schema = @Schema(implementation = ErrorResponse.class)))

0 commit comments

Comments
 (0)