Skip to content

fix: skip importing response types for binary endpoints#30

Merged
santiagomed merged 1 commit intomainfrom
fix/binary-response-import-error
Mar 13, 2026
Merged

fix: skip importing response types for binary endpoints#30
santiagomed merged 1 commit intomainfrom
fix/binary-response-import-error

Conversation

@santiagomed
Copy link
Contributor

Problem

Operations that return application/octet-stream (binary data) like chatMediaDownload don't have response model classes generated in models.j2, since those templates only generate models for application/json responses.

However, the client_class.j2 templates were importing response types for ALL operations with 200/201 responses, causing build errors like:

src/chat/client.ts(36,1): error TS2305: Module '"./models.js"' has no exported member 'MediaDownloadResponse'.

Solution

Added a check in both TypeScript and Python client_class.j2 templates to only import response types for operations that actually return JSON content, matching the behavior of the models templates.

Binary response operations correctly use ArrayBuffer (TypeScript) or bytes (Python) as return types and don't need imported response model types.

Testing

  • Rebuilt TypeScript SDK: ✅ builds successfully
  • Rebuilt Python SDK: ✅ builds successfully

Operations that return application/octet-stream (binary data) don't have
response model classes generated in models.j2, since those templates only
generate models for application/json responses.

However, the client_class.j2 templates were importing response types for
ALL operations with 200/201 responses, causing import errors like:
  Module '"./models.js"' has no exported member 'MediaDownloadResponse'

This fix adds a check in both TypeScript and Python client_class.j2
templates to only import response types for operations that actually
return JSON content, matching the behavior of the models templates.

Binary response operations (like chatMediaDownload) correctly use
ArrayBuffer (TypeScript) or bytes (Python) as return types and don't
need imported response model types.
@santiagomed santiagomed merged commit 7ece1a2 into main Mar 13, 2026
4 checks passed
@santiagomed santiagomed deleted the fix/binary-response-import-error branch March 13, 2026 03:38
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.

2 participants