Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Feature Request] Standalone validator tool

Aperta
#312 2 commenti 2 reazioni 0 assegnatari Vedi su GitHub

@facontidavide ci sta già lavorando.

Dal 17/9/2026.

  • #388 di @facontidavide — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python, yaml
Ambito
cli, tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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_value must be present in the config)
  • Namespace structure (the ros__parameters nesting in config YAMLs)
  • Mapped parameters (__map_<key> where possible, i.e. when the key parameter has a default_value or 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_only is 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 pip in any environment. This matches how generate_parameter_library_markdown works.
  • The existing YAML parsing logic in generate_parameter_library_py.parse_yaml already understands the full parameter definition DSL and could be reused as the foundation.
  • The config YAML parser needs to handle the ros__parameters namespace and the /** or node-specific namespacing conventions.
  • Consider also supporting a --output-json-schema flag 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_markdown already 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
Lingua principale
Python
Stelle
385
Fork
81
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PickNikRobotics/generate_parameter_library

Tutte le issue di PickNikRobotics/generate_parameter_library

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.