handle omitted is true bools
This commit is contained in:
@@ -108,6 +108,7 @@ type FieldInfo struct {
|
||||
IsArray bool
|
||||
Fields map[string]*FieldInfo
|
||||
CustomUnmarshalType string
|
||||
CustomUnmarshalFunc string
|
||||
}
|
||||
|
||||
func NewResource(structName string, resourcePath string) *Resource {
|
||||
@@ -346,6 +347,17 @@ func main() {
|
||||
f.OmitEmpty = true
|
||||
return nil
|
||||
}
|
||||
case "Network":
|
||||
resource.FieldProcessor = func(name string, f *FieldInfo) error {
|
||||
switch name {
|
||||
case "InternetAccessEnabled", "IntraNetworkAccessEnabled":
|
||||
if f.FieldType == "bool" {
|
||||
f.CustomUnmarshalType = "*bool"
|
||||
f.CustomUnmarshalFunc = "emptyBoolToTrue"
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
case "SettingGlobalAp":
|
||||
resource.FieldProcessor = func(name string, f *FieldInfo) error {
|
||||
if strings.HasPrefix(name, "6E") {
|
||||
|
||||
Reference in New Issue
Block a user