-
Notifications
You must be signed in to change notification settings - Fork 154
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
The generated OptString.Decode() method in oas_json_gen.go fails when encountering null values in JSON,
causing errors like "unexpected byte 110 'n'".
Expected Behavior
OptString should handle null values gracefully, similar to how OptNilString handles them.
Current Behavior
func (o *OptString) Decode(d *jx.Decoder) error {
o.Set = true
v, err := d.Str() // Fails on null
if err != nil {
return err
}
o.Value = string(v)
return nil
}
Suggested Fix
func (o *OptString) Decode(d *jx.Decoder) error {
if d.Next() == jx.Null {
if err := d.Null(); err != nil {
return err
}
o.Set = false
o.Value = ""
return nil
}
o.Set = true
v, err := d.Str()
if err != nil {
return err
}
o.Value = string(v)
return nil
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working