Skip to content

Commit 08134ab

Browse files
16bit-ykikoclaude
andcommitted
fix(serde): add schema::default_value to skip_if_default
`skip_if_default<T>` omits fields during serialization when they equal the default value, but did not declare them as optional during deserialization. After #95 added required field checking, this caused LSP types using `optional_bool` (= `skip_if_default<bool>`) to reject valid messages when clients omit proposed/newer capability fields. Fix: add `schema::default_value` to `skip_if_default`'s annotation list so the field is recognized as optional during deserialization. This keeps serialization and deserialization semantics orthogonal — `skip_if` alone remains serialization-only, `default_value` alone is deserialization-only, and `skip_if_default` explicitly opts into both. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2a1eb83 commit 08134ab

File tree

1 file changed

+1
-1
lines changed
  • include/eventide/serde/serde

1 file changed

+1
-1
lines changed

include/eventide/serde/serde/attrs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ template <typename T>
4242
using skip_if_empty = annotation<T, behavior::skip_if<pred::empty>>;
4343

4444
template <typename T>
45-
using skip_if_default = annotation<T, behavior::skip_if<pred::default_value>>;
45+
using skip_if_default = annotation<T, behavior::skip_if<pred::default_value>, schema::default_value>;
4646

4747
} // namespace eventide::serde

0 commit comments

Comments
 (0)