Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swagger: Add DataProviderCapabilities to swagger documentation #143

Merged

Conversation

bhufmann
Copy link
Contributor

@bhufmann bhufmann commented Jan 20, 2025

What it does

This PR adds the DataProviderCapabilities API to the swagger documentation.

See ADR: eclipse-cdt-cloud/theia-trace-extension#1158

How to test

Run trace-server and create the API documentation as described here https://github.com/eclipse-cdt-cloud/trace-server-protocol?tab=readme-ov-file#generate-the-api.

Follow-ups

N/A

Review checklist

  • As an author, I have thoroughly tested my changes and carefully followed the instructions in this template

Signed-off-by: Bernd Hufmann [email protected]

@@ -64,4 +64,11 @@ enum ProviderType {
*/
@Schema(required = false, description = "Optional input configuration used to create this derived data provider.")
Configuration getConfiguration();

/**
* @return option output capabilities.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

/**
* @return The name.
*/
@JsonProperty("canCreate")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should each capabilities parameter be independently optional (required=false) or only the parent 'capabilities'?

Or none? I'm not sure what is the intended outcome, the ADR did not have any optional in the javascript example. In the Java code (IDataProviderDescriptor) the capabilities field is not nullable.

Copy link
Contributor Author

@bhufmann bhufmann Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should make each one optional. I guess it could save some bytes over the TSP. However, on the client side of the TSP, we would have to handle if fields are not there. Either way, let me know what you prefer. It will affect the related PRs (tsp-typescript-client/tsp-python-client).

BTW, the class DataProviderDescriptorSerializer determines if the capabilities are serialized or not. IDataProviderDescriptor is the Trace Compass internal implementation/API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think we agree to make each subfield optional. It's required=false by default so nothing to change in this file.

/**
* @return The name.
*/
@JsonProperty("canCreate")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think we agree to make each subfield optional. It's required=false by default so nothing to change in this file.

/**
* @return option output capabilities.
*/
@Schema(required = false, description = "Optional output capabilities, such as \"canCreate\" and \"canDelete\".")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The required option is false by default, so we can probably omit it everywhere that it's set to false (or leave it to be explicit?).

But it should be added when required = true, I believe in this file it should be added to the fields id, name, description, type. This is how it's currently implemented in tsp-typescript-client.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update the description to make sure that they are optional and what is supposed to happen when omitted. I won't fix the other fields that should have required=true because it should be in a separate PR. I noticed more data structures that need fixing.

/**
* @return optional output capabilities.
*/
@Schema(description = "Optional output capabilities, such as \"canCreate\" and \"canDelete\". If omitted, all capabilites are false.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capabilities

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

public interface OutputCapabilities {

/**
* @return The name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

boolean canCreate();

/**
* @return The ID.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@bhufmann bhufmann merged commit 00a007b into eclipse-tracecompass-incubator:master Jan 21, 2025
2 checks passed
@bhufmann bhufmann deleted the dp-capabilities branch January 21, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants