- Add resolve_constraints_in_content() to handle ${constraint.path} patterns
- Integrate into all form loading functions (load_from_file, load_fragment_form, etc)
- Support nested path navigation (e.g., constraints.tracker.udp.max_items)
- Add test_constraint_interpolation() test
fix(nickel-roundtrip): apply constraint interpolation in roundtrip workflow
- Fix execute_form() to use load_from_file() instead of parse_toml()
- Ensures constraints are resolved in roundtrip mode
docs(examples): add constraint interpolation example
- Create examples/05-fragments/constraints.toml
- Update examples/05-fragments/array-trackers.toml to use ${constraint.*}
- Document constraint workflow in examples/05-fragments/README.md
Benefits:
- Single source of truth for validation limits
- Forms auto-resolve constraints at load time
- All layers (Forms, Nickel, Templates) sync automatically
21 lines
593 B
TOML
21 lines
593 B
TOML
# Validation Constraints for Tracker Arrays
|
|
# Single source of truth for min/max items and uniqueness rules
|
|
#
|
|
# This file is imported by array-trackers.toml via constraint interpolation:
|
|
# max_items = "${constraint.tracker.udp.max_items}"
|
|
# max_items = "${constraint.tracker.http.max_items}"
|
|
#
|
|
# Change these values and the form will automatically use them!
|
|
|
|
[tracker.udp]
|
|
# UDP tracker listeners - BitTorrent standard port 6969
|
|
min_items = 0
|
|
max_items = 4
|
|
unique = true
|
|
|
|
[tracker.http]
|
|
# HTTP tracker listeners - Standard HTTP/HTTPS ports 80/443
|
|
min_items = 0
|
|
max_items = 4
|
|
unique = true
|