mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 22:53:34 +08:00
Tools/validate_yaml: add schema validation for module yaml config files
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
# Cerberus Validation Schema for module configuration files.
|
||||
# See http://docs.python-cerberus.org/en/stable/validation-rules.html
|
||||
|
||||
|
||||
module_name:
|
||||
# human-readable module name (used for descriptions, can contain spaces)
|
||||
type: string
|
||||
required: true
|
||||
|
||||
serial_config:
|
||||
# UART configuration (optional)
|
||||
# A module can register autostart command(s) that are associated with a
|
||||
# configuration parameter, so that a user can select on which serial port to
|
||||
# run the command.
|
||||
# One or several commands can be defined.
|
||||
type: list
|
||||
minlength: 1
|
||||
schema:
|
||||
type: dict
|
||||
schema:
|
||||
command:
|
||||
# script command that is executed on autostart.
|
||||
# These variables can be used:
|
||||
# ${SERIAL_DEV} Serial device (e.g. /dev/ttyS1)
|
||||
# ${BAUD_PARAM} param name for the baudrate
|
||||
# ${i} instance in [0, N-1] (for multi-instance commands)
|
||||
# It's possible to use multiple lines.
|
||||
type: string
|
||||
required: true
|
||||
|
||||
port_config_param:
|
||||
# Parameter definition to configure on which port to run the
|
||||
# command
|
||||
type: dict
|
||||
required: true
|
||||
schema:
|
||||
name:
|
||||
# Parameter name (e.g. TEL_FRSKY_CONFIG, MAV_${i}_CONFIG)
|
||||
type: string
|
||||
regex: '[0-9A-Z_]+(\$\{i\}[0-9A-Z_]*)?'
|
||||
required: true
|
||||
group:
|
||||
# Associated parameter group (e.g. GPS)
|
||||
type: string
|
||||
required: true
|
||||
default:
|
||||
# Default value(s). This can be a string to specify the
|
||||
# serial tag (e.g. GPS1, TEL1, ...) or a list of strings
|
||||
# for multiple instances.
|
||||
# If omitted, the command is disabled by default.
|
||||
anyof:
|
||||
- type: string
|
||||
- type: list
|
||||
minlength: 1
|
||||
schema:
|
||||
type: string
|
||||
label:
|
||||
# Optional command label (e.g. used in the autostart script).
|
||||
# If omitted, module_name is used.
|
||||
type: string
|
||||
num_instances:
|
||||
# Allow to configure and run multiple instances of a command.
|
||||
# For multiple instances, '${i}' can be used to refer to
|
||||
# an instance, for example in the parameter name or script
|
||||
# command.
|
||||
# Default: 1
|
||||
type: integer
|
||||
min: 1
|
||||
|
||||
parameters:
|
||||
type: list
|
||||
# TODO
|
||||
|
||||
Reference in New Issue
Block a user