-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
Confirm this is a Typescript library issue and not an underlying Cloudflare API issue
- This is an issue with the Typescript library
Describe the bug
Summary
The TypeScript definitions for JsonCreateParams.ResponseFormat
in the Browser Rendering API are incorrect. The interface defines schema
but the actual API expects json_schema
, causing runtime errors when following the TypeScript types.
Environment
- SDK Version:
[email protected]
- API Endpoint:
/accounts/{account_id}/browser-rendering/json
- TypeScript Version: 5.8.3
Expected Behavior
The TypeScript interface should match the actual API contract. According to the Cloudflare docs, the API expects:
json { "response_format": { "type": "json_schema", "json_schema": { ... } } }
Actual Behavior
The TypeScript interface incorrectly defines:
typescript export interface ResponseFormat { type: string; schema?: Record<string, unknown>; // Should be json_schema }


Steps to Reproduce
- Use the Browser Rendering JSON endpoint with
response_format.schema
- Follow the TypeScript definitions
- Receive 422 error: "Cannot read properties of undefined (reading 'hasOwnProperty')"
Working Code (with workaround)
typescript response_format: { type: 'json_schema', json_schema: mySchema, // Works, but requires casting to any } as any
Failing Code (following TypeScript types)
typescript response_format: { type: 'json_schema', schema: mySchema, // Fails at runtime despite TypeScript approval }
Fix Required
Update the TypeScript interface to match the API:
typescript export interface ResponseFormat { type: string; json_schema?: Record<string, unknown>; // Correct property name }
### To Reproduce
Provided above
### Code snippets
```Typescript
Provided above
OS
macOS
Runtime version
Typescript 5.8.3
Library version
v4.3.0
P.S. Issue description generated by LLM on request from Alexander
Metadata
Metadata
Assignees
Labels
No labels