You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the json.dumps function is used to encode data, a custom JSONEncoder subclass could be used that encodes these additional values and falls back to the default encoder for all other values (like numbers).
The custom encoder can be specified using the cls argument of the json.dumps function.
Possible alternatives (optional)
No response
Screenshots (optional)
No response
Additional Context (optional)
Some types like Tables and Images are useful for inspection purposes.
They should be able to be displayed in the VS Code extension to show information about the data of a pipeline.
Currently, placeholders are sent in the data field of the placeholder_value message.
The text was updated successfully, but these errors were encountered:
Closes#20
### Summary of Changes
- added SafeDSEncoder that is used for custom types (tables, images)
- don't crash when unknown types are attempted to be sent, instead send
a "\<Not Displayable\>" placeholder value
- added encoding tests + not displayable to existing message exchange
---------
Co-authored-by: megalinter-bot <[email protected]>
Is your feature request related to a problem?
The runner needs to know how to serialize certain objects to JSON, as they need to be sent to the VS Code extension.
Currently, these types would be:
Table (https://github.com/Safe-DS/Library/blob/main/src/safeds/data/tabular/containers/_table.py)
A JSON representation already exists by calling
to_json_file
. To use this here, a new method without files would be neededImage (https://github.com/Safe-DS/Library/blob/main/src/safeds/data/image/containers/_image.py)
An image can be represented as a byte array by calling
_repr_png_
. This could be encoded to a string with base64.Desired solution
As the
json.dumps
function is used to encode data, a customJSONEncoder
subclass could be used that encodes these additional values and falls back to the default encoder for all other values (like numbers).The custom encoder can be specified using the
cls
argument of thejson.dumps
function.Possible alternatives (optional)
No response
Screenshots (optional)
No response
Additional Context (optional)
Some types like Tables and Images are useful for inspection purposes.
They should be able to be displayed in the VS Code extension to show information about the data of a pipeline.
Currently, placeholders are sent in the
data
field of theplaceholder_value
message.The text was updated successfully, but these errors were encountered: