You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wouldn't tsconfig with strictNullChecks enabled require nullable notation for a Required Optional pydantic field, considering it could contain None?
I'm not well-versed in TypeScript, but from what I understand, it's acceptable to have | null type annotations (if somewhat unusual), and in this case, it would make Python's responses much clearer for those handling them in TypeScript.
Please correct me if I'm mistaken, as my knowledge of TypeScript might be lacking.
Thanks for the amazing work on the package, it's incredibly useful!
The text was updated successfully, but these errors were encountered:
This seems to be an unresolved issue in pydantic with BaseModel.schema_json and the JSON Schema specification it supports. There are multiple workarounds mentioned in the issue I linked
From Python 3.10 onwards
Type | None
is supposed to be preferred overOptional[Type]
pydantic's documentation gives a Python 3.10+ code example for a Required field which is also "Optional" (can receive None as a value).
Versions
"strictNullChecks": true
is set in the library's tsconfig.json)To Reproduce
Expected Result:
Notes:
Wouldn't tsconfig with
strictNullChecks
enabled require nullable notation for a Required Optional pydantic field, considering it could containNone
?I'm not well-versed in TypeScript, but from what I understand, it's acceptable to have
| null
type annotations (if somewhat unusual), and in this case, it would make Python's responses much clearer for those handling them in TypeScript.Please correct me if I'm mistaken, as my knowledge of TypeScript might be lacking.
Thanks for the amazing work on the package, it's incredibly useful!
The text was updated successfully, but these errors were encountered: