weaviate / weaviate-go-client

BSD 3-Clause "New" or "Revised" License
29 stars 11 forks source link

Getting Schema is not marshalled correctly #198

Open ili16 opened 9 months ago

ili16 commented 9 months ago

When running the go code to retrieve schema information as described in the documentation;

package main

import (
  "context"
  "fmt"

  "github.com/weaviate/weaviate-go-client/v4/weaviate"
)

func main() {
  cfg := weaviate.Config{
    Host:   "localhost:8080",
    Scheme: "http",
  }
  client, err := weaviate.NewClient(cfg)
  if err != nil {
    panic(err)
  }

  schema, err := client.Schema().Getter().Do(context.Background())
  if err != nil {
    panic(err)
  }
  fmt.Printf("%v", schema)

I receive a hexadecimal representation of the Dump:

Schema: &{{[0xc0000be0a0] }}

I can fix that manually by marshalling it myself:

jsonSchema, err := json.MarshalIndent(schema, "", "  ")

if err != nil {
    panic(err)
}

fmt.Printf("%s\n", jsonSchema)

The python client and a curl work fine so I would expect the go-client to behave the same. I guess the problem lies in the Getter.Do Function but I do not know how to test the change locally