You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Moving definitions directly under properties almost* yields the expected result.
* minus the pointer symbol
Result:
// ...// House typeHousestruct {
Address*Address`json:"address,omitempty"`Owners*Person`json:"owners,omitempty"`// WRONG// should be []*Person
}
// ...
Expected:
// ...// House typeHousestruct {
Address*Address`json:"address,omitempty"`Owners []*Person`json:"owners,omitempty"`
}
// ...
The text was updated successfully, but these errors were encountered:
I dug in here because I thought I hit this bug, but it was a user error.
AFACIT, this works correctly now; if I put the OP code into test.schema.json, I get the following:
➜ schema-generate test.schema.json
// Code generated by schema-generate. DO NOT EDIT.
package main
// Address
type Address struct {
Number int `json:"number,omitempty"`
Postcode string `json:"postcode,omitempty"`
}
// House
type House struct {
Address *Address `json:"address,omitempty"`
Owners []*Person `json:"owners,omitempty"`
}
// Person
type Person struct {
Name string `json:"name,omitempty"`
}
Parking this here until I (or somebody else) look into it.
Given the following JSON schema:
The generated
Owners
field is not an array.Moving definitions directly under
properties
almost* yields the expected result.* minus the pointer symbol
Result:
Expected:
The text was updated successfully, but these errors were encountered: