Test
|
5a465b145c
|
feat(routing): implement JSONPath resolver
Task 2.1 COMPLETE ✅
JSONPath expression resolution system for workflow parameter binding:
- jsonpath.go: Main resolver with methods:
- NewJSONPathResolver(input, stepResults) - Create resolver
- Resolve(expr) - Resolve single expression: ${input.repo}, ${Step.output.field}
- ResolveString(str) - Resolve strings with multiple expressions
- ResolvePaths(map) - Recursively resolve entire parameter maps
- navigateObject(obj, parts) - Navigate through nested objects
- resolveValue(value) - Resolve values recursively (strings, maps, slices)
- ValidatePath(path) - Validate path syntax
- GetAvailableSteps() - List available steps
- GetInputFields() - List available input fields
- Supported expressions:
- ${input.repo} - Access input parameters
- ${Clone.output.path} - Access step results
- ${Analyze.output.metrics.quality.score} - Deep nesting
- String interpolation: "Path: ${Clone.output.path}"
- Works with maps, slices, and nested structures
- jsonpath_test.go: 14 comprehensive tests
- Single field resolution (input, steps)
- Nested field access (deep nesting)
- Non-template strings
- Error handling (missing steps, missing fields)
- String interpolation with multiple expressions
- Map resolution (pure templates vs embedded expressions)
- Nested maps and slices
- String map support
- Complex workflow scenarios
- Empty input handling
- All tests PASS ✅ (14/14 JSONPath tests)
Total tests now: 55/55 PASS ✅
- 8 type tests
- 14 knowledge base tests
- 30 validator tests
- 14 JSONPath tests
Acceptance criteria met:
✅ Resolves ${input.*} expressions
✅ Resolves ${Step.output.*} expressions
✅ Handles deep nesting
✅ String interpolation works
✅ Recursive resolution (maps, slices)
✅ Error handling for missing paths
✅ Pure template vs embedded expressions
✅ Ready for activity selection (Task 2.2)
Effort: 3 hours (estimated)
Files: jsonpath.go (209 lines)
jsonpath_test.go (423 lines)
Phase 2 Progress: 1 of 5 tasks complete (20%)
|
2026-08-31 19:46:10 -07:00 |
|