fix(typescript): serialize JSON header parameter content

Merged
AN
2mo ago
+353-12

Description

Fix JSON-content header serialization for generated model parameters in typescript-fetch and typescript-node.

For typescript-fetch, JSON-content headers backed by generated model schemas use the model’s existing ToJSON conversion before JSON.stringify.

For typescript-node, they use ObjectSerializer.serialize before JSON.stringify.

This preserves OpenAPI wire property names such as file_path when the generated TypeScript property is filePath.

The same handling applies to JSON structured-suffix media types such as application/vnd.example+json.

typescript-axios was checked with the same reproduction and already produces the expected JSON header, so no change is needed there.

Tests

Focused tests cover:

  • required and optional JSON-content model headers
  • application/vnd.example+json
  • ordinary schema-based string headers
  • renamed model properties
  • referenced header Parameters
  • webhook-only model headers
  • withoutRuntimeChecks=true

Generated typescript-fetch clients compile successfully in both normal mode and with withoutRuntimeChecks=true.

Fixes #25086