[Feature Request] Standalone validator tool
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reading generate_parameter_library_py.parse_yaml and the existing generate_parameter_library_markdown CLI as the issue suggests. Then map how parameter definitions and ROS 2 config namespaces are represented before scoping the validator. Done means a standalone Python CLI validates the requested types and constraints without ROS 2, reports failures clearly, and handles the stated out-of-scope cases; an open linked pull request indicates work is already underway.
Written by the indexing model from the issue text.
Description
Summary
Add a CLI tool (e.g. generate_parameter_library_validate) that validates a ROS 2 parameter config YAML against one or more parameter definition YAMLs, without requiring a ROS 2 runtime, a colcon build, or a running node.
Motivation
Currently, the only way to validate whether a config YAML conforms to the parameter definitions is to build the generated code, launch a node with --params-file, and observe whether it throws. This works during development, but creates pain in two important scenarios:
CI pipelines: A robotics project may have dozens of parameter definition YAMLs across packages and a large monolithic (or composed) config YAML that is deployed to the robot. When someone changes a parameter value in that config, the only feedback loop today is a full colcon build + node launch. A lightweight validation step in CI (similar to a linter) would catch issues like typos in parameter names, wrong types, or out-of-bounds values in seconds rather than minutes.
Field engineers and integrators: People who configure robots on-site often do not have a full build environment. They edit YAML config files and deploy them. A wrong parameter name or an out-of-range value currently only surfaces as a runtime crash or cryptic error message on the robot. A standalone validation tool that they can run on their laptop (with just a pip install) would save significant debugging time and prevent deploying broken configs to production robots.
The library already has generate_parameter_library_markdown as a precedent for a standalone tool that reads the parameter definition YAML and produces useful output without requiring ROS 2. A validator would follow the same pattern.
Proposed interface
# Validate a single config against a single parameter definition
generate_parameter_library_validate \
--param-definition src/my_package/config/my_parameters.yaml \
--config config/robot.yaml
# Validate against multiple parameter definitions (common for composed systems)
generate_parameter_library_validate \
--param-definition src/pkg_a/config/a_parameters.yaml \
--param-definition src/pkg_b/config/b_parameters.yaml \
--config config/robot.yaml
# Strict mode: also warn about parameters in the config
# that do not appear in any definition (catches typos)
generate_parameter_library_validate \
--param-definition src/my_package/config/my_parameters.yaml \
--config config/robot.yaml \
--strict
Exit code 0 on success, non-zero on validation failure, with human-readable error messages:
ERROR: my_node.background.r: value 300 violates bounds<>[0, 255]
ERROR: my_node.background.colour: unknown parameter (did you mean 'color'?)
ERROR: my_node.pid.rate: expected type 'double', got 'string' ("fast")
WARNING: my_node.background.b: missing from config, will use default_value 0
Scope of validation
The parameter definition YAML format already encodes rich type and constraint information. The following built-in validators all map cleanly to static checks that can be performed without a ROS 2 runtime:
Value validators: bounds<>, lt<>, gt<>, lt_eq<>, gt_eq<>, one_of<>
String validators: fixed_size<>, size_gt<>, size_lt<>, not_empty<>, one_of<>
Array validators: unique<>, subset_of<>, fixed_size<>, size_gt<>, size_lt<>, not_empty<>, element_bounds<>, lower_element_bounds<>, upper_element_bounds<>
The tool should also check:
- Type correctness (e.g. int vs double vs string vs arrays)
- Required parameters (parameters without
default_valuemust be present in the config) - Namespace structure (the
ros__parametersnesting in config YAMLs) - Mapped parameters (
__map_<key>where possible, i.e. when the key parameter has adefault_valueor is present in the config)
Explicitly out of scope (with warning):
- Custom C++ validator functions (e.g.
"my_project::integer_equal_value": [3]). These are arbitrary code and cannot be evaluated offline. The tool should emit a warning:INFO: my_node.param: custom validator 'my_project::integer_equal_value' cannot be checked offline, skipped read_onlyis a runtime behavioral constraint, not checkable offline
Implementation considerations
- The tool should be a pure Python CLI with no dependency on ROS 2 packages, so it can be installed via
pipin any environment. This matches howgenerate_parameter_library_markdownworks. - The existing YAML parsing logic in
generate_parameter_library_py.parse_yamlalready understands the full parameter definition DSL and could be reused as the foundation. - The config YAML parser needs to handle the
ros__parametersnamespace and the/**or node-specific namespacing conventions. - Consider also supporting a
--output-json-schemaflag that converts the parameter definitions to JSON Schema. This would enable integration with existing JSON Schema tooling and IDE support (e.g. YAML language server in VS Code for autocompletion and inline validation of config files).
Example CI usage
# GitHub Actions example
- name: Validate robot config
run: |
pip install generate_parameter_library
generate_parameter_library_validate \
--param-definition src/navigation/config/nav_parameters.yaml \
--param-definition src/behavior/config/behavior_parameters.yaml \
--config deploy/config/robot_production.yaml \
--strict
Related
generate_parameter_library_markdownalready demonstrates the pattern of a standalone CLI tool that processes parameter definition YAMLs- Issue #59 reports confusing runtime error messages for invalid configs, which offline validation would help prevent
- Issue #30 discusses separating validation logic, which aligns with making validation available outside of generated code
- Dominant language
- Python
- Stars
- 385
- Forks
- 81
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PickNikRobotics/generate_parameter_library
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
PickNikRobotics/generate_parameter_library#392 · 2 comments ·
-
GCC 15 emits -Wfree-nonheap-object for generated string one_of validationPossibly taken @tylerjw claimed this 24 days ago. Open
PickNikRobotics/generate_parameter_library#389 · 1 comment · 1 assignee ·
-
Feature request: math in the yamlPossibly taken @tylerjw claimed this 24 days ago. Open
PickNikRobotics/generate_parameter_library#381 · 2 comments · 1 reaction · 1 assignee ·
-
Validator reference (bounds<>/element_bounds<> etc.) is hard to find inside the READMEMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
PickNikRobotics/generate_parameter_library#377 · 1 comment ·
-
`.inf` not within floating point rangePossibly taken @christianrauch claimed this 74 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 30/100
PickNikRobotics/generate_parameter_library#376 · 3 comments ·
All issues in PickNikRobotics/generate_parameter_library
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
CLIMADA-project/climada_python#1337 ·
Maintainers usually reply within 3 days
-
tail without reverseOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
8go/matrix-commander#233 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
documentation enhancement priority:high size:M
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Validate non-divisible effective batch sizes in the Unsloth LoRA backendPossibly taken @debesh-biswas claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100