Model seems to ignore `.optional()` fields, and instead uses fasly values such as 0, empty strings etc'
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
Solution: Model seems to ignore `.optional()` fields, and instead uses fasly values such as 0, empty strings etc'
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
Trust Score
3 verifications
- 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
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
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep