For the CLI, it'd be helpful to print the original JSON sent from the server. Currently, the Go objects are decoded from the server JSON and re-encoded into JSON, which would omit any fields that aren't accounted for in the model.
This PR adds an internal rawJSON field to structs, which stores the raw JSON message passed in UnmarshalJSON. If rawJSON isn't blank, MarshalJSON returns this value directly; otherwise, the object is marshaled normally.
For the CLI, it'd be helpful to print the original JSON sent from the server. Currently, the Go objects are decoded from the server JSON and re-encoded into JSON, which would omit any fields that aren't accounted for in the model.
This PR adds an internal
rawJSON
field to structs, which stores the raw JSON message passed inUnmarshalJSON
. IfrawJSON
isn't blank,MarshalJSON
returns this value directly; otherwise, the object is marshaled normally.