Add RawValue support for non-converted Payloads #1664
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was changed
Added
RawValue
support for non-converted Payloads - a thin wrapper aroundPayload
.RawValue
is intended to be used for payloads that bypasses normal payload conversion. It uses the presence of theMETADATA_RAW_VALUE_KEY
in its payload's metadata to determine if the payload bypasses normal payload conversion or not.It has a minimal API, useful for custom data converters that use
RawValue
, including:send
: to be used when sending theRawValue
to the server (i.e.toPayload
)send
adds metadata to its payload that identifies it as aRawValue
.This metadata (
METADATA_RAW_VALUE_KEY
) is used to check whether a payload is aRawValue
on arrival.This metadata should be checked before you...
receive
: to be used a payload you expect to be aRawValue
from the server (i.e.fromPayload
)receive
strips the raw value metadata and constructs aRawValue
This is a different approach to how this was implemented in other SDKs as TS does not include type hints or similar when converting from a payload back to its original representation. As such, we use the payload metadata to give us a hint.
Also modified the existing built-in metadata query to return a
RawValue
(formerly returned the metadata proto object). This is not backwards compatible, existing users of this query (principally UI and CLI) will need to convert thepayload
from theRawValue
(see example in the test).Closes [Feature Request] Support "RawValue" non-converted values #1629, [Feature Request] Built-in query responses should use "RawValue" #1630
How was this tested:
Added short integration test, modified the existing built-in metadata test.
Any docs updates needed?
Possibly. Maybe for the change to the built-in metadata query.