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
it seems that optional fields using pointers to values are not handled by schema properly. e.g.:
type S struct {
Flag *bool `schema:"flag"`
}
if we encode such an empty struct S{} it will result in url.Values{"flag": []string{"null"}}, which is not decodable by schema. The solution is to use omitempty. But it is easy to miss that. Can we panic on such fields to make sure omitempty is not missing? Another option is to handle correctly "null" values on decode.
Opinion?
Expected Behavior
Correctly encode/decode on empty struct with pointers.
Steps To Reproduce
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Current Behavior
it seems that optional fields using pointers to values are not handled by schema properly. e.g.:
if we encode such an empty struct
S{}
it will result inurl.Values{"flag": []string{"null"}}
, which is not decodable by schema. The solution is to useomitempty
. But it is easy to miss that. Can we panic on such fields to make sure omitempty is not missing? Another option is to handle correctly "null" values on decode.Opinion?
Expected Behavior
Correctly encode/decode on empty struct with pointers.
Steps To Reproduce
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: