Skip to content

fix(typescript): serialize JSON header parameter content - #25088

Open
AndreyVMarkelov wants to merge 1 commit into
OpenAPITools:masterfrom
AndreyVMarkelov:fix/typescript-json-header
Open

AndreyVMarkelov wants to merge 1 commit into
OpenAPITools:masterfrom
AndreyVMarkelov:fix/typescript-json-header

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Oct 1, 2026 •

Copy link
Copy Markdown

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

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 8 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache Outdated
Comment thread modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread modules/openapi-generator/src/test/resources/3_1/typescript-json-header.yaml Outdated
@AndreyVMarkelov
AndreyVMarkelov force-pushed the fix/typescript-json-header branch from 1cc3c26 to 603ce19 Compare October 1, 2026 21:47

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][TypeScript] JSON-content header parameter is not serialized as JSON

1 participant