I have a JSON schema with a property "address"
"address": {
"type": "string",
"format": "ipv4",
"default": "127.0.0.1"
}
which correctly generates a struct like
type Server struct {
// Address corresponds to the JSON schema field "address".
Address netip.Addr `json:"address,omitempty"
}
but the func UnmarshalJSON tries to set a string instead of an netip.Addr.
plain.Address = "127.0.0.1"
Should be something like so
plain.Address, err = netip.ParseAddr("127.0.0.1")
if err != nil {
return err
}