IValue
representation within GraphQL
#3548
greymistcube
started this conversation in
Polls
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Although we use
IValue
almost exclusively in terms of storing data, there is no consensus on how this should be served over the GraphQL service that we provide. There are numerous endpoints where conversions are dealt with separately with varying return formats.Given some
value
of typeIValue
, there are currently four major formats in use:value
encoded as byte array.value
encoded as byte array.value
according to this schemavalue
similar to usage in python.Currently, the following simple query
would return something like
that is, a hex representation by default without a way to retrieve the value in any other format.
Now, if we are to provide a general API to retrieve an
IValue
, we should try to standardize the API.In order to allow a user to decide which representation to retrieve, such information must be passed on. Here I propose three different possible schemes.
Scheme 1
Scheme 2
Scheme 3
Schemes 2 and 3 have additional advantage where it can be applied more generally. Such as querying serialized
Block
orTransaction
in a more modular fashion. For example,can be changed more easily by adding a field (or fields) of an existing graph type.
3 votes ·
Beta Was this translation helpful? Give feedback.
All reactions