Validate service descriptors
Current situation
Service descriptors are not strictly validated. This can lead to errors that are not detected at start time.
The basic elements are validated by the launcher (valid YAML files, with a metadata.name entry and possibly a cmd one too).
Desired outcome
A function to check a service descriptors (as it should be usable from the allinone plugin that performs delayed loading of the aggregated descriptors).
Check basic sections:
-
inputs -
outputs -
events (only check existence and type) -
metadata -
cmd -
spec.commandParameters -
branding (only check existence and type) -
reports (only check existence and type)
Implementation
def validate_descriptors(plugin: Flask) -> None:
"""Validate descriptor.
Validate descriptor against PLUGIN_DESCRIPTOR schema for provider
and generator plugins.
If applicable, `default` values are checked against the input's
`type`.
# Required parameters
- plugin: a Flask application
# Raised exceptions
A _ValueError_ exception is raised if the descriptor is invalid.
"""
Edited by Martin Lafaix