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
type A struct{
F1 *int64 `schema:"f1"`
F2 string `schema:"f2"`
}
the decoder option is set as below
d := schema.NewDecoder()
d.IgnoreUnknownKeys(true)
if err := d.Decode(inp, v); err != nil {
return err
}
schema is decoded successfully but empty values are not omitted.
Expected Behavior
inp := new(A)
got result:
{"f1": 0 , "f2" : " "}
expected
{ }
docs - https://pkg.go.dev/github.com/gorilla/schema#Decoder.IgnoreUnknownKeys
this suggest is similar to encoding/json behaviour when a un known key is encountered it will be skipped and valid keys will still be decoded.
Am i doing something incorrect?
is there any other tag i need to add? like omitempty
Steps To Reproduce
No response
Anything else?
docs - https://pkg.go.dev/github.com/gorilla/schema#Decoder.IgnoreUnknownKeys
this suggest is similar to encoding/json behaviour when a un known key is encountered it will be skipped and valid keys will still be decoded.
Am i doing something incorrect?
is there any other tag i need to add? like omitempty
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Current Behavior
the decoder option is set as below
schema is decoded successfully but empty values are not omitted.
Expected Behavior
inp := new(A)
got result:
expected
docs - https://pkg.go.dev/github.com/gorilla/schema#Decoder.IgnoreUnknownKeys
this suggest is similar to encoding/json behaviour when a un known key is encountered it will be skipped and valid keys will still be decoded.
Am i doing something incorrect?
is there any other tag i need to add? like
omitempty
Steps To Reproduce
No response
Anything else?
docs - https://pkg.go.dev/github.com/gorilla/schema#Decoder.IgnoreUnknownKeys
this suggest is similar to encoding/json behaviour when a un known key is encountered it will be skipped and valid keys will still be decoded.
Am i doing something incorrect?
is there any other tag i need to add? like omitempty
The text was updated successfully, but these errors were encountered: