-
Couldn't load subscription status.
- Fork 14
Open
Description
Summary
The response from get table request is not parsed properly
sample code
func tryGetTable(ctx context.Context, client *restapi.ClientWithResponses, keyspaceName string, tableName string) {
rsp, err := client.GetTableWithResponse(ctx, keyspaceName, tableName, &restapi.GetTableParams{})
if err != nil {
panic(err)
}
enc := json.NewEncoder(os.Stdout)
enc.Encode(rsp.JSON200)
}
expected result
{"columnDefinitions":[{"name":"firstname","static":false,"typeDefinition":"text"},{"name":"lastname","static":false,"typeDefinition":"text"}],"keyspace":"ghoti","name":"foo","primaryKey":{"clusteringKey":[],"partitionKey":["firstname"]},"tableOptions":{"clusteringExpression":[],"defaultTimeToLive":0}}
actual result
{"columnDefinitions":null,"name":"","primaryKey":{"partitionKey":null}}
invesitigation
there is a top level data key in the response
$ curl -s -H 'Content-Type: application/json' -H "X-Cassandra-Token: ${ASTRA_DB_TOKEN}" \
https://${ASTRA_DB_ID}-${ASTRA_DB_REGION}.apps.astra.datastax.com/api/rest/v2/schemas/keyspaces/${ASTRA_DB_KEYSPACE}/tables/foo \
| jq .
{
"data": {
"name": "foo",
"keyspace": "ghoti",
"columnDefinitions": [
{
"name": "firstname",
"typeDefinition": "text",
"static": false
},
{
"name": "lastname",
"typeDefinition": "text",
"static": false
}
],
"primaryKey": {
"partitionKey": [
"firstname"
],
"clusteringKey": []
},
"tableOptions": {
"defaultTimeToLive": 0,
"clusteringExpression": []
}
}
}
It should be included in the specification here
astra-client-go/rest-api-swagger.yaml
Lines 210 to 216 in c640f33
| responses: | |
| '200': | |
| description: '' | |
| content: | |
| application/json: | |
| schema: | |
| "$ref": "#/components/schemas/Table" |
Metadata
Metadata
Assignees
Labels
No labels