Skip to content

[Bug]: Unexpected field as JSON String instead of number #5158

Open
@jpalvarezl

Description

@jpalvarezl

Describe the bug

While generating the client library for the Azure OpenAI Realtime Audio client library, I noticed that the fields prefix_padding_ms and silence_duration_ms are serialized as JSON Strings, but the service actually expects a JSON number, failing the request.

The TSP definition for the model in question can be found here: https://github.com/joseharriaga/openai-in-typespec/blob/0cd29e191a157fe4356fed68707a2c43a5f728be/.typespec/realtime/custom.tsp#L106-L115

We are fully aware that we might not be using duration correctly. So this could very well be a spec definition issue from our side.

Reproduction

  • Re-add the @Generated annotation to the fields prefixPaddingMs and silenceDurationMs in RealtimeServerVadTurnDetection class as well as to the toJson method.
  • The member variables should now be generated as Java Duration types
  • toJson will try to serialize these as String using jsonWriter.writeStringField

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingemitter:client:javaIssue for the Java client emitter: @typespec/http-client-java

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions