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
Understanding the difference between `optional` and `nullable` is important for properly modeling your API:
32
+
Understanding the difference between `optional` and `nullable` is important for modeling your API:
33
33
34
-
-**`optional<T>`**: The field can be omitted from the request/response entirely. When omitted, the field is not sent over the wire.
34
+
-**`optional<T>`**: The field can be omitted from the request/response entirely. When omitted, the field isn't sent over the wire.
35
35
-**`nullable<T>`**: The field must be present but can be explicitly set to `null`. This allows you to distinguish between "not specified" and "explicitly cleared".
36
36
37
37
```yaml
@@ -43,12 +43,12 @@ types:
43
43
bio: nullable<string> # Must be present, but can be null
44
44
```
45
45
46
-
This distinction is particularly important for PATCH requests where you need to differentiate between:
46
+
This distinction is particularly important for HTTP PATCH requests where you need to differentiate between:
47
47
1. **Omitting a field** - Don't update this field (keep existing value)
48
48
2. **Setting to `null`** - Clear this field (remove the value)
49
49
3. **Setting to a value** - Update this field with a new value
0 commit comments