Input validation for XML launch files
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 155
- Forks
- 182
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
Feature request
Feature description
One of the advantages of using Python-based launch files as opposed to XML is the ability to validate input arguments and parameters. For example, if the launch file allows the user to set the arg robot_ip, it should not accept a malformed address. Instead, it would be nice if it informed the user of the mistake. Other than catching typos, input validation could potentially catch dependency issues, such as missing plugins. I believe validating string types would provide the most benefit, such as IP address, plugin names, file paths, etc. but numerical types could also be validated by checking upper or lower bounds.
In terms of implementation, there are several ways it can be expressed. The simplest solution is to add a regex tag that uses regex, e.g.
<arg name="robot_ip" default="127.0.0.1" regex="^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$"/>
A more elaborate solution could use dedicated tags for common validation types, e.g.
<arg name="robot_ip" default="127.0.0.1" validators="ip_address"/>
<arg name="web_server" default="http://127.0.0.1:8080" validators="url"/>
<arg name="dof" default="7" validators="one_of([6,7])"/>
I think there are other ways to achieve the same effect. I'm also interested in knowing how others might go about implementing it and what types of validations would provide the most value.
*credit to stackoverflow for IP regex
Contributor 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.
Research direction
No files, tests, or entry points are named. First clarify the validation syntax, supported validation types, error behavior, and scope before locating the XML argument parsing code and defining tests for malformed and valid values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100