(rustType: string, isRequired: boolean)
| 842 | } |
| 843 | |
| 844 | function wrapOption(rustType: string, isRequired: boolean): string { |
| 845 | if (isRequired) return rustType; |
| 846 | // Already wrapped in Option — don't double-wrap. |
| 847 | if (rustType.startsWith("Option<")) { |
| 848 | return rustType; |
| 849 | } |
| 850 | // Non-required Vec/HashMap must be Option<Vec<…>> / Option<HashMap<…>> |
| 851 | // so the SDK can distinguish "field omitted" (None) from "explicitly |
| 852 | // empty" (Some(vec![])). Bare Vec/HashMap with #[serde(default)] would |
| 853 | // serialize as `[]`/`{}` for unset fields, which patch-style request |
| 854 | // types (e.g. SessionUpdateOptionsParams) interpret as "clear the |
| 855 | // list" — silently wiping server-side state set elsewhere. |
| 856 | return `Option<${rustType}>`; |
| 857 | } |
| 858 | |
| 859 | // ── Struct emission ───────────────────────────────────────────────────────── |
| 860 |
no outgoing calls
no test coverage detected
searching dependent graphs…