Closed richburdon closed 4 years ago
Ref https://github.com/graphql/graphql-spec/issues/91, let's discuss on Slack before choosing between nested queries (limited to a certain depth) and a JSONString value type.
@richburdon I've had a long discussion with Ashwin, we can support your high level ask of:
wire xbox query --json | jq .attributes[signal].server
returning the correct thing, but it will not be using the GQL endpoint because that's not what GQL is for.
For example:
wnscli query nameservice list --node tcp://node1.dxos.network:26657 | jq '.[].attributes.signal | select(. != null).server'
returns the expected output. something similar to this should be used instead of GQL.
wire
and the GQL endpoint should be connecting to an indexer, not directly to the blockchain node. A given indexer could be configured to support whatever GQL endpoint we need and would know how to decode the record types. Indexing is a separate service that would be incentivized within the network.
WNS should not be record type aware and should not support those types of queries, CosmosSDK does not support these types of databases. Vulcanize is waiting on a grant to add said functionality to the CosmosSDK.
wire
and the GQL endpoint should be connecting to an indexer, not directly to the blockchain node. A given indexer could be configured to support whatever GQL endpoint we need and would know how to decode the record types. Indexing is a separate service that would be incentivized within the network.
This is an implementation detail (GraphQL querying in-process, or separate process) and a false distinction from a technical perspective imho. From an incentive perspective I agree there's a distinction but a query node operator can disable blockchain transaction service and vice versa.
Discussed with @richburdon on Slack, we're going with the simpler approach for now - using JSONString value type, which will contain stringified JSON. At the registy-client side, it will get converted into a normal JSON object.
Query will look like:
attributes {
key
value {
null
int
float
string
boolean
json # <--------- NEW ADDITION
reference {
id
}
}
}
After changes:
$ yarn wire xbox query
yarn run v1.22.0
$ /Users/ashwinp/projects/wireline/incubator/node_modules/.bin/wire xbox query
[
{
"id": "Qmc6dQHCoDDWZ7Xf2YhL5itZS2kYuPShqayE21g3QXX4Hn",
"type": "wrn:xbox",
"name": "xbox1.bozemanpass",
"version": "0.0.1",
"owners": [
"6ee3328f65c8566cd5451e49e97a767d10a8adf7"
],
"bondId": "20cd5d8f6dd7e4e2904836b341f0b5b6de89be8b6b9247a95f9b26944b8fba9a",
"createTime": "2020-04-28T05:47:34.834900000",
"expiryTime": "2021-04-28T05:47:34.834900000",
"attributes": {
"type": "wrn:xbox",
"version": "0.0.1",
"name": "xbox1.bozemanpass",
"signal": {
"server": "xbox1.bozemanpass.net:4000"
}
}
}
]
Deployment:
wire CLI v1.0.0-beta.29
dashboard 1.0.0-beta.11
E.g.,
signal
below should be a JSON object (the CLI/tools should not have to parse this). The GQL supports compound.https://github.com/wirelineio/wns/blob/master/gql/schema.graphql
https://github.com/wirelineio/wns/blob/0c9931c81afd546c885afe20b6be8e320c05cfe5/x/nameservice/internal/types/types.go#L30