northwesternmutual / grammes

A Go package built to communicate with Apache TinkerPop™ Graph computing framework using Gremlin; a graph traversal language used by graph databases such as JanusGraph®, MS Cosmos DB, AWS Neptune, and DataStax® Enterprise Graph.
Apache License 2.0
125 stars 45 forks source link

Failed to execute example add-vertex-by-query #8

Closed posilva closed 4 years ago

posilva commented 4 years ago

When I try to execute this example I am getting this error:

json: cannot unmarshal string into Go struct field VertexValue.@value.id of type model.ID}

The json generated is this:

{
    "@type": "g:List",
    "@value": [
        {
            "@type": "g:Vertex",
            "@value": {
                "id": "78b774f6-e7a0-26bf-2fb8-fb25d413aea5",
                "label": "person",
                "properties": {
                    "name": [
                        {
                            "@type": "g:VertexProperty",
                            "@value": {
                                "id": {
                                    "@type": "g:Int32",
                                    "@value": 1032144519
                                },
                                "label": "name",
                                "value": "damien"
                            }
                        }
                    ]
                }
            }
        }
    ]
}

Looking at the code the VertexValue struct has an ID that does not support String but instead a struct


type ID struct {
Type  string `json:"@type"`
    Value int64  `jjson:"@value"`
}

That's why the error, not able to convert the ID: "78b774f6-e7a0-26bf-2fb8-fb25d413aea5" to the mentioned struct.

I am using version grammes v1.1.1

damienfamed75 commented 4 years ago

What database are you using? What are the steps used to recreate this?

posilva commented 4 years ago

I am using AWS Neptune. Just notice one issue closed, that reports the same error. Closing this one