mirror of
https://github.com/hanzoai/go-openai.git
synced 2026-10-30 14:51:51 +00:00
MarshalJSON had drifted to a pointer receiver while Properties gained
`,omitempty`. Together those defeated the nil->empty-map fill: encoding/json
never invokes a pointer-receiver MarshalJSON on non-addressable values (map
entries, a Definition passed by value), and omitempty drops the empty map even
when it does. Nested schemas therefore lost the "properties":{} that OpenAI
requires on object schemas — the exact bug #419/#434 fixed.
Value receiver restores the guarantee for map entries and by-value marshals;
dropping omitempty lets the filled empty map through. TestDefinition_MarshalJSON
(got and gotPtr) passes again.
Co-authored-by: Hanzo Dev <[email protected]>