Skip to content

Validation Tools

Tools for validating blocks and flowgraphs.

validate_block

Validate a single block’s configuration.

Parameters

NameTypeDefaultDescription
block_namestr-Name of the block to validate

Returns

Type: bool

True if the block is valid.

Example

is_valid = validate_block(block_name="osmosdr_source_0")
# Returns: True

validate_flowgraph

Validate the entire flowgraph.

Checks all blocks and connections for errors.

Returns

Type: bool

True if the flowgraph is valid.

Example

is_valid = validate_flowgraph()
# Returns: True

Notes

  • Validation checks parameter types, required connections, and compatibility
  • Use get_all_errors() to see specific validation failures
  • generate_code() does not require validation to pass

get_all_errors

Get all validation errors from the flowgraph.

Returns

Type: list[ErrorModel]

List of errors with block name, parameter, and message.

Example

errors = get_all_errors()
# Returns: [
# ErrorModel(
# block="audio_sink_0",
# param="samp_rate",
# message="Sample rate 50000 not supported by audio device"
# ),
# ...
# ]
# Empty list means no errors
errors = get_all_errors()
# Returns: []

Error Types

Common validation errors:

Error TypeExample
Missing connection”Block has unconnected input port”
Type mismatch”Cannot connect complex to float”
Invalid parameter”Invalid sample rate value”
Missing dependency”Block requires gr-osmosdr”