Southclaws / supervillain

Converts Go structs to Zod schemas
MIT License
76 stars 6 forks source link

Datastore keys are not correctly encoded as strings #3

Closed 8gian closed 1 year ago

8gian commented 1 year ago

Datastore Key structs should be encoded to strings, similar to time.Time structs. In general it would be nice if this library had a way to insert information about custom serializations of specific types.

For now, in our repo, we have fixed this issue by vendoring and changing line 267 as follows:

        } else if (t.PkgPath() == "time" && t.Name() == "Time") || ((t.PkgPath() == "google.golang.org/appengine/datastore" || t.PkgPath() == "cloud.google.com/go/datastore") && t.Name() == "Key") {
            // timestamps are serialised to strings as are datastore keys.
8gian commented 1 year ago

I just found the CustomFn code. Seems like that will work for us.