codex - 💡(How to fix) Fix Doc: SDK README uses incorrect case for zod-to-json-schema target value

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

In sdk/typescript/README.md line 72, the documentation states:

You can also create a JSON schema from a Zod schema using the zod-to-json-schema package and setting the target to "openAi".

And the code example at line 81:

outputSchema: zodToJsonSchema(schema, { target: "openAi" }),

However, the zod-to-json-schema package does not have a "openAi" target option. The valid target values are "jsonSchema7", "jsonSchema2019-09", "openApi3", etc. The value "openAi" is not a recognized target.

If this is a custom target supported by the version used in this project, it should be documented as such. Otherwise, users copying this example will get unexpected behavior.

Root Cause

In sdk/typescript/README.md line 72, the documentation states:

You can also create a JSON schema from a Zod schema using the zod-to-json-schema package and setting the target to "openAi".

And the code example at line 81:

outputSchema: zodToJsonSchema(schema, { target: "openAi" }),

However, the zod-to-json-schema package does not have a "openAi" target option. The valid target values are "jsonSchema7", "jsonSchema2019-09", "openApi3", etc. The value "openAi" is not a recognized target.

If this is a custom target supported by the version used in this project, it should be documented as such. Otherwise, users copying this example will get unexpected behavior.

Code Example

outputSchema: zodToJsonSchema(schema, { target: "openAi" }),
RAW_BUFFERClick to expand / collapse

Description

In sdk/typescript/README.md line 72, the documentation states:

You can also create a JSON schema from a Zod schema using the zod-to-json-schema package and setting the target to "openAi".

And the code example at line 81:

outputSchema: zodToJsonSchema(schema, { target: "openAi" }),

However, the zod-to-json-schema package does not have a "openAi" target option. The valid target values are "jsonSchema7", "jsonSchema2019-09", "openApi3", etc. The value "openAi" is not a recognized target.

If this is a custom target supported by the version used in this project, it should be documented as such. Otherwise, users copying this example will get unexpected behavior.

Location

  • File: sdk/typescript/README.md, lines 72 and 81
  • Also in sample: sdk/typescript/samples/structured_output_zod.ts, line 17

Suggested fix

Verify whether "openAi" is actually supported by the zod-to-json-schema version used in this project. If not, update to the correct target value.

extent analysis

TL;DR

Update the target option in zodToJsonSchema to a valid value, such as "openApi3", if "openAi" is not a custom target supported by the project's zod-to-json-schema version.

Guidance

  • Verify the version of zod-to-json-schema used in the project to check if it supports a custom target named "openAi".
  • Check the documentation of zod-to-json-schema for valid target values, such as "jsonSchema7", "jsonSchema2019-09", or "openApi3".
  • Update the code example in sdk/typescript/README.md and sdk/typescript/samples/structured_output_zod.ts to use a valid target value if "openAi" is not supported.
  • Test the updated code to ensure it produces the expected JSON schema output.

Example

outputSchema: zodToJsonSchema(schema, { target: "openApi3" }),

Notes

The fix assumes that "openAi" is not a custom target supported by the project's zod-to-json-schema version. If it is a custom target, it should be documented as such to avoid confusion.

Recommendation

Apply workaround: Update the target option to a valid value, such as "openApi3", to ensure the code produces the expected JSON schema output.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Doc: SDK README uses incorrect case for zod-to-json-schema target value