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
{{ message }}
Repository navigation
Commit 1cd3bca
Browse filesBrowse the repository at this point in the historyBrowse files
Update CHANGELOG for version 0.1.3; fix typing for nullable model fields in update() methods across multiple resources to allow passing None without type errors.
Copy file name to clipboardExpand all lines: skills/SKILL.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,6 +85,8 @@ Keep retry, auth, serialization, pagination, and error mapping in shared infrast
85
85
86
86
Use `NOT_GIVEN` for omitted optional arguments. Omit a kwarg to leave a field unchanged. Pass `None` only when the API intentionally distinguishes explicit null from omission.
87
87
88
+
If the corresponding model field is typed `T | None` (nullable in the read model), the parameter must be typed `T | None | NotGiven`, not just `T | NotGiven` — otherwise callers clearing the field with `None` get a static type error even though it works at runtime.
Copy file name to clipboardExpand all lines: skills/references/development.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ For create/update methods:
43
43
44
44
1. Prefer keyword-only arguments.
45
45
2. Use generated model types for nested request bodies.
46
-
3. Default optional omitted fields to `NOT_GIVEN`.
46
+
3. Default optional omitted fields to `NOT_GIVEN`. If the field is nullable on the generated model (`T | None`), type the parameter `T | None | NotGiven`, not just `T | NotGiven`, so callers can pass `None` to clear it without a type error.
47
47
4. Build a body mapping.
48
48
5. Let `_base.py` and `_transport.py` omit `NOT_GIVEN` and serialize models/enums.
0 commit comments