Open GoogleCodeExporter opened 9 years ago
After thinking a bit, I am not entirely sure that it's a valid request. Or,
likely, it's too narrow.
Unlike protobuf library, the Go API client library does not distinguish between
zero value and not set value. There would always be APIs which could not be
properly accessed due to this issue.
I don't say it's impossible to design an API which will always obey "not set
value == default value", but the existing APIs are not like that.
Original comment by krasin@google.com
on 17 Jun 2014 at 6:47
(feel free to close this issue with Working-As-Intended).
Original comment by krasin@google.com
on 17 Jun 2014 at 6:47
The same issue exists with the Content API for Shopping. For an AccountsUser,
the admin field is a required boolean, so you can't make non-admin users with
the Go library.
Better than removing the omitempty would be having an omitnil, but sadly that
doesn't exist.
Original comment by msca...@google.com
on 11 Aug 2014 at 9:02
Same things happens with Cloud Datastore, if I post an entity like this:
entity := &datastore.Entity{
Key: key,
Properties: map[string]datastore.Property{
"username": datastore.Property{StringValue: "someuser"},
"favorite": datastore.Property{BooleanValue: false},
},
}
I get this error in response: "googleapi: Error 400: Property \"favorite\" has
no value., INVALID_ARGUMENT"
So I can only store `true` values in Datastore.
Original comment by treeder
on 21 Nov 2014 at 1:17
Original issue reported on code.google.com by
krasin@google.com
on 17 Jun 2014 at 6:58