Files
hatchet/api/v1/server/oas/openapi/nonnulljson.go
T
Matt Kaye 771b733e10 Feat: Add Parent Task External ID to workflow run details, Fix input type marshalling to null (#1505)
* feat: add parent task external id to api for workflow run

* feat: wire up parent ids

* feat: custom go type for non-null json

* feat: gen

* feat: send action ids back over the api

* fix: lint
2025-04-07 23:40:13 -04:00

30 lines
537 B
Go

package openapi
import (
"bytes"
"encoding/json"
)
type NonNullableJSON map[string]interface{}
func (m *NonNullableJSON) UnmarshalJSON(data []byte) error {
if bytes.Equal(data, []byte("null")) {
*m = NonNullableJSON{}
return nil
}
var raw map[string]interface{}
if err := json.Unmarshal(data, &raw); err != nil {
return err
}
*m = NonNullableJSON(raw)
return nil
}
func (m NonNullableJSON) MarshalJSON() ([]byte, error) {
if m == nil {
return []byte("{}"), nil
}
return json.Marshal(map[string]interface{}(m))
}