Skip to content

Releases: Nordlys-Labs/openai-go

v0.1.2: Fix JSON union unmarshaling for missing discriminator fields

28 Dec 17:20
f98510c

Choose a tag to compare

Bug Fixes

  • Fixed JSON union unmarshaling to handle missing discriminator fields
  • Modified newStructUnionDecoder to check if discriminator field exists before failing
  • Modified newUnionDecoder with the same discriminator existence check
  • Added unit tests for missing discriminator field scenarios
  • Added integration tests for real OpenAI types

This fixes the OpenAI API's 'easy input' format where messages can be sent without a 'type' field. When the discriminator field is missing, the code now falls through to try-all-variants logic instead of immediately returning an error.

Commits since v0.1.1:

  • f98510c Fix JSON union unmarshaling for missing discriminator fields