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
</details>
With 0.21.5, the output of the above is:
name: test
created: "2025-01-09T16:13:43.220-08:00"
With 0.21.6, and all newer versions including 0.23.0, the output is:
name: test
(no output for `created`).
The primary reason is that when the field is specified as a value, only value methods can be called.
The fix was originally added to because `swag.IsZero` did not handle pointer, but that was fixed in https://github.com/go-openapi/swag/pull/67 so I think the the `IsZero` method should be moved back to the value.
The text was updated successfully, but these errors were encountered:
prashantv
added a commit
to prashantv/strfmt
that referenced
this issue
Jan 10, 2025
The switch to pointer receivers to fix #106 broke YAML marshalling of
strfmt.DateTime
when used with aomitempty
value field.Repro:
import (
"fmt"
"time"
)
type S struct {
Name string
yaml:"name"
Created strfmt.DateTime
yaml:"created,omitempty"
}
func main() {
s := S{
Name: "test",
Created: strfmt.DateTime(time.Now()),
}
marshalled, err := yaml.Marshal(s)
if err != nil {
panic(err)
}
}
name: test
created: "2025-01-09T16:13:43.220-08:00"
name: test
The text was updated successfully, but these errors were encountered: