abujehad139 / google-api-go-client

Automatically exported from code.google.com/p/google-api-go-client
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

An array of floats represented as strings causes json decoding to fail #39

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
When the json of a field in the api is like this:
"schemas": {
 "Person": {
"scores": {
  "type": "array",
  "items": {
     "type": "string",
     "format": "float64",
   }
}
}
}

The generated Go struct looks like this:
Person {
   Scores []float64 `json:"scores,omitempty"`
}

Then when the api returns something like 
{ "scores": ["1234", "234", "234"] }
The json decoder fails because it's expecting an array of float64s, but its 
receiving an array of strings.

This failure can be seen here:
http://play.golang.org/p/TOMqS10VMo

Original issue reported on code.google.com by pcarle...@google.com on 26 Aug 2013 at 11:11