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

OutputElementStyle.values contains values other than "object" #102

Open
awendelin-work opened this issue Jul 19, 2024 · 0 comments
Open

Comments

@awendelin-work
Copy link

The trace-server (built from incubator 4b14d71637df2cedecd48d4287851315418a2d31) is inconsistent with the openapi specification with regards to the format of OutputElementStyle.

OutputElementStyle is defined in the openapi specification as follows:

OutputElementStyle:
  type: object
  properties:
    parentKey:
      type: string
    values:
      type: object
      additionalProperties:
        type: object

This matches an example JSON like:

"style": {
  "parentKey": "mykey",
  "values": {
    "value0": {"type": 12},
    "value1": {"color": "blue"}
  }
}

What the server actually responds with (xy model for HistogramDataProvider) is JSON like:

"style": {
  "parentKey": null,
  "values": {
    "series-type": "line"
  }
}

or (from latency analysis I believe):

"style": {
  "parentKey": null,
  "values": {
    "series-type": "scatter"
  }
}

Notice how the keys of "values" point to strings and not to objects.

I think the underlying issue is because the openapi specification (and
implementation of OutputElementStyle) is defined in Java as:

public interface OutputElementStyle {
    ...
    Map<String, Object> getValues();
    ...

The Java notion of an Object can mean a lot of things, but a JSON
notion of an Object is more specific and does not include strings.

It appears the values of an OutputElementStyle should rather be
defined as any type. See free-form objects in:
https://swagger.io/docs/specification/data-models/dictionaries/

diff --git a/API.yaml b/API.yaml
index af1ee4c..1060590 100644
--- a/API.yaml
+++ b/API.yaml
@@ -1605,7 +1605,6 @@ components:
         values:
           type: object
           additionalProperties:
-            type: object
             description: Style values or empty map if there are no values. Keys and
               values are defined in https://git.eclipse.org/r/plugins/gitiles/tracecompass/org.eclipse.tracecompass/+/refs/heads/master/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/model/StyleProperties.java
           description: Style values or empty map if there are no values. Keys and
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

No branches or pull requests

1 participant