in http/server/operationrequest/operationrequest_helper.go [116:141]
func FlattenOperationRequest(op *BaseOperationRequest) map[string]interface{} {
result := make(map[string]interface{})
val := reflect.ValueOf(op).Elem()
typ := val.Type()
for i := 0; i < val.NumField(); i++ {
field := typ.Field(i)
// Skip unexported fields.
if field.PkgPath != "" {
continue
}
// Skip fields explicitly tagged to be ignored.
if tag := field.Tag.Get("json"); tag == "-" {
continue
}
fv := val.Field(i)
if !fv.CanInterface() {
continue
}
// If the field type is a function or an unsupported type like *http.Request, skip it
if fv.Kind() == reflect.Func || (fv.Kind() == reflect.Ptr) {
continue
}
result[field.Name] = fv.Interface()
}
return result
}