-
Notifications
You must be signed in to change notification settings - Fork 24
Allow double and remove boolean in OutputElementStyle (type of property values) #192
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
Allow double and remove boolean in OutputElementStyle (type of property values) #192
Conversation
Previously only float values were allowed. Don't restrict to float and allow Double as well. Note when deserializing JSON strings a floating point value will be deserialized to Double, e.g. when using Jackson deserializer (Java) or in Javascript. Remove boolean because it can be expressed as String and boolean have no equivalent type in CSS where the StyleProperties are inspired of. Contributes to: eclipse-cdt-cloud/trace-server-protocol#102 Signed-off-by: Bernd Hufmann <[email protected]>
| assertTrue(deserialized.getStyleValues().isEmpty()); | ||
| } | ||
|
|
||
| private static void veryStyles(OutputElementStyle testStyle, OutputElementStyleStub deserialized) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verifyStyles?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| gen.writeStringField("parentKey", value.getParentKey()); | ||
|
|
||
| // Verify the type of style values. Make sure only supported types are returned. | ||
| Map<String, Object> newValues = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe could use startObject/writeField/endObject pattern to write directly without needing copied map, and preserve original map order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. This will avoid looping through the map multiple times. The order doesn't really matter, unless the input map is a LinkedHashMap that preserves the insertion order.
Previously only float values were allowed. Don't restrict to float and allow Double as well. Note when deserializing JSON strings a floating point value will be deserialized to Double, e.g. when using Jackson deserializer (Java) or in Javascript. Remove boolean because it can be expressed as String and boolean have no equivalent type in CSS where the StyleProperties are inspired of. Contributes to: eclipse-cdt-cloud#102 Corresponding swagger model update: eclipse-tracecompass-incubator/org.eclipse.tracecompass.incubator#192 Signed-off-by: Bernd Hufmann <[email protected]>
This will make sure that only objects that comply with the TSP specification are serialized. Added unit tests to verify this. eclipse-cdt-cloud/trace-server-protocol#102 Signed-off-by: Bernd Hufmann <[email protected]>
dad714c
into
eclipse-tracecompass-incubator:master
Previously only float values were allowed. Don't restrict to float and allow Double as well. Note when deserializing JSON strings a floating point value will be deserialized to Double, e.g. when using Jackson deserializer (Java) or in Javascript. Remove boolean because it can be expressed as String and boolean have no equivalent type in CSS where the StyleProperties are inspired of. Contributes to: #102 Corresponding swagger model update: eclipse-tracecompass-incubator/org.eclipse.tracecompass.incubator#192 Signed-off-by: Bernd Hufmann <[email protected]>
What it does
swagger: Allow double and remove boolean in OutputElementStyle
Previously only float values were allowed. Don't restrict to float and allow Double as well. Note when deserializing JSON strings a floating point value will be deserialized to Double, e.g. when using Jackson deserializer (Java) or in Javascript. Remove boolean because it can be expressed as String and boolean have no equivalent type in CSS where the StyleProperties are inspired of.
server: Only serialize supported value types in OutputElementStyle
This will make sure that only objects that comply with the TSP specification are serialized. Added unit tests to verify this.
Contributes to:
eclipse-cdt-cloud/trace-server-protocol#102
How to test
Successful execution of newly added test case
Follow-ups
TSP spec. update
Review checklist