UnmarshalJSON for ViewUpdate accepts `config` either as the canonical JSON-encoded string shape OR as the natural nested object shape any reasonable HTTP client would send. Mirrors ItemUpdate.UnmarshalJSON; the struct field stays `*string` and downstream consumers (store writes, web/CLI) are unchang
(data []byte)
| 80 | // at views.go:152 only sees empty-string-or-valid-object input; the |
| 81 | // "is it a JSON object" assertion sits at the handler boundary. |
| 82 | func (u *ViewUpdate) UnmarshalJSON(data []byte) error { |
| 83 | type alias ViewUpdate |
| 84 | aux := struct { |
| 85 | Config json.RawMessage `json:"config,omitempty"` |
| 86 | *alias |
| 87 | }{alias: (*alias)(u)} |
| 88 | |
| 89 | if err := json.Unmarshal(data, &aux); err != nil { |
| 90 | return err |
| 91 | } |
| 92 | |
| 93 | configStr, err := flexJSONToString(aux.Config, '{', ErrInvalidConfigType) |
| 94 | if err != nil { |
| 95 | return err |
| 96 | } |
| 97 | u.Config = configStr |
| 98 | |
| 99 | return nil |
| 100 | } |
nothing calls this directly
no test coverage detected