Missing data types in nested struct
cixtor opened this issue · comments
Take the JSON object below and try to generate a Go struct.
You’ll notice that both “user_agent” and “referer” will end up lacking the “string” type.
{
"project": "90368",
"logger": "javascript",
"platform": "javascript",
"request": {
"user_agent": "Foobar",
"referer": "https://cixtor.com/"
},
"release": "v3-1633-gbb54e4ad",
"event_id": "b0cfac40a3374cc686b1"
}
Thanks for reporting. It appears to be a regression caused by #47. I will work on a fix. As a work-around, you can uncheck Inline type definitions, until a fix is published.
#52 should address the issue when it gets merged and deployed.
@Mahdi-Hosseini — @mholt : are you two completely sure this bug has been fixed?
I just tested this JSON in the live version of the project and it still fails to add some types:
{
"id": 123,
"username": "john",
"licenses": [
{
"id": 123,
"spots": 3,
"volume": false,
"team": null,
"available": true,
"bundle_identifier": "com.example.Foo"
}
],
"volume_licenses": [],
"team_subscription": false
}
Notice how all the fields inside Licenses are missing the type:
type AutoGenerated struct {
ID int `json:"id"`
Username string `json:"username"`
Licenses []struct {
ID `json:"id"`
Spots `json:"spots"`
Volume `json:"volume"`
Team `json:"team"`
Available `json:"available"`
BundleIdentifier `json:"bundle_identifier"`
} `json:"licenses"`
VolumeLicenses []interface{} `json:"volume_licenses"`
TeamSubscription bool `json:"team_subscription"`
}
Yes, I'm sure. I get:
type AutoGenerated struct {
ID int `json:"id"`
Username string `json:"username"`
Licenses []struct {
ID int `json:"id"`
Spots int `json:"spots"`
Volume bool `json:"volume"`
Team interface{} `json:"team"`
Available bool `json:"available"`
BundleIdentifier string `json:"bundle_identifier"`
} `json:"licenses"`
VolumeLicenses []interface{} `json:"volume_licenses"`
TeamSubscription bool `json:"team_subscription"`
}
Make sure your cache is totally cleared.
Oh! You are right 😲 it was the browser cache. Thank you very much 👍