FG
🤖 AI & LLMsOpenAI

Model seems to ignore `.optional()` fields, and instead uses fasly values such as 0, empty strings etc'

Fresh11 months ago
Mar 14, 20260 views
Confidence Score87%
87%

Problem

Confirm this is a Node library issue and not an underlying OpenAI API issue - [X] This is an issue with the Node library Describe the bug Model seems to ignore `.optional()` fields, and instead uses nullary values, empty strings etc' I'm not sure if it's a library issue or chatgpt model issue. To Reproduce I suspect this is a KI or an upstream problem, but let me know if not I'll send a repro Code snippets _No response_ OS ubuntu Node version 22.7.0 Library version 4.57.0

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
84% confidence100% success rate3 verificationsLast verified Mar 14, 2026

Solution: Model seems to ignore `.optional()` fields, and instead uses fasly values such as 0, empty strings etc'

Low Risk

This may be the line of code that converts an optional property to required. [propDef.isOptional() && !refs.openaiStrictMode ? acc.required : [...acc.required, propName],](https://github.com/openai/openai-node/blob/a92cc1dbc4ab3284c6654d69d5c39399a867f601/src/_vendor/zod-to-json-schema/parsers/object.ts#L54) I don't see any code for making the property nullable. In my testing I don't see the outp

84

Trust Score

3 verifications

100% success
  1. 1

    This may be the line of code that converts an optional property to required.

    [propDef.isOptional() && !refs.openaiStrictMode ? acc.required : [...acc.required, propName],](https://github.com/openai/openai-node/blob/a92cc1dbc4ab3284c6654d69d5c39399a867f601/src/_vendor/zod-to-json-schema/parsers/object.ts#L54)

  2. 2

    I don't see any code for making the property nullable. In my testing I don't see

    I don't see any code for making the property nullable. In my testing I don't see the output schema nullable either.

Validation

Resolved in openai/openai-node GitHub issue #1180. Community reactions: 2 upvotes.

Verification Summary

Worked: 3
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

openaigptllmapibug