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
For the most part when the JSON generated by the Rust generated code is used, it is sufficient that the JSON is self-describing but not self identifying.
For example, when encoding an ScVal::I32(1), the JSON will be {"i32":1}.
As long as the decoder knows that the value is an ScVal they can decode the type.
There are some situations where it would be useful to be able to self identify the type that has been encoded, and for applications to have a common way to do that, such that it is part of the JSON schema.
For example in a form such as {"type":"ScVal","i32":1} or {"ScVal":{"i32":1}}.
It would also be convenient if that frame was extendable with arbitrary attributes. For the Stellar XDR use case specifically those additional attributes would include an XDR version number, such that applications that store JSON values longer term can identify which XDR<>JSON schema needs to be used to decode the value.
For example {"version":"20.0.0","type":"ScVal","i32":1}.
The text was updated successfully, but these errors were encountered:
For the most part when the JSON generated by the Rust generated code is used, it is sufficient that the JSON is self-describing but not self identifying.
For example, when encoding an
ScVal::I32(1)
, the JSON will be{"i32":1}
.As long as the decoder knows that the value is an
ScVal
they can decode the type.There are some situations where it would be useful to be able to self identify the type that has been encoded, and for applications to have a common way to do that, such that it is part of the JSON schema.
For example in a form such as
{"type":"ScVal","i32":1}
or{"ScVal":{"i32":1}}
.It would also be convenient if that frame was extendable with arbitrary attributes. For the Stellar XDR use case specifically those additional attributes would include an XDR version number, such that applications that store JSON values longer term can identify which XDR<>JSON schema needs to be used to decode the value.
For example
{"version":"20.0.0","type":"ScVal","i32":1}
.The text was updated successfully, but these errors were encountered: