Raxol. AgentClientProtocol. Schema. MaybeUndefined
(Raxol Agent Client Protocol v0.1.0)
Copy Markdown
View Source
A three-state value type: :undefined, nil (null), or {:value, term}.
Distinguishes a missing field (undefined) from an explicitly null field. This is load-bearing for partial-update semantics where omitting a field means "don't change" and setting it to null means "clear".
Raxol.AgentClientProtocol.Schema.Unstable.SessionInfoUpdate uses this
type: its decoder maps an absent key to :undefined and passes a present
value through from_json/1 (null -> nil, anything else ->
{:value, v}); its encoder omits :undefined fields via the {:skip}
sentinel returned by to_json/1.
JSON serialization
:undefined-> field is omitted from JSON outputnil->null{:value, x}-> the JSON encoding ofx
Ported from the MIT f1729/agent_client_protocol (c) 2025 f1729; see NOTICE.md.
Summary
Functions
Decodes from JSON deserialization. Call with :missing if the key was not
present, or with the raw value if it was.
Maps a function over the value, preserving undefined/null.
Returns true if the value is null.
Encodes for JSON serialization. Returns {:skip} for undefined (the caller
omits the field), nil for null, or the value itself.
Returns true if the value is undefined.
Applies partial-update semantics against a current value.
Returns the inner value, or nil if undefined or null.
Returns true if the value carries a value.
Types
Functions
Decodes from JSON deserialization. Call with :missing if the key was not
present, or with the raw value if it was.
Maps a function over the value, preserving undefined/null.
Returns true if the value is null.
Encodes for JSON serialization. Returns {:skip} for undefined (the caller
omits the field), nil for null, or the value itself.
Returns true if the value is undefined.
Applies partial-update semantics against a current value.
:undefined-> returns the current value unchanged (don't change)nil-> returns nil (clear){:value, v}-> returns v (set)
Returns the inner value, or nil if undefined or null.
Returns true if the value carries a value.