resolvePath static method
Resolves a JSON Pointer into a ZorphyLens over ToolCallOutcome.
One switch step per segment, so a pointer costs O(depth) — no regex, no mirrors, no reflective lookup.
A pointer this node does not carry answers null.
Implementation
static ZorphyLens<ToolCallOutcome, Object?>? resolvePath(String pointer) {
return switch (pointer) {
'/ok' => ZorphyLens<ToolCallOutcome, Object?>(
path: '/ok',
get: (root) => root.ok,
set: (root, value) => root.copyWith(ok: value as bool),
),
'/summary' => ZorphyLens<ToolCallOutcome, Object?>(
path: '/summary',
get: (root) => root.summary,
set: (root, value) => root.copyWith(summary: value as String),
),
_ => null,
};
}