-
Notifications
You must be signed in to change notification settings - Fork 1
Validset
github-actions[bot] edited this page May 12, 2026
·
1 revision
The validset field restricts a configuration value to a defined set of allowed values. If the value is not in the list, an InvalidValueParameterException is raised.
{ "name": "source.format", "validset": ["csv", "json", "parquet"] }The simplest form: a list of exact allowed string values.
{ "name": "source.format", "validset": ["csv", "json", "parquet"] }
{ "name": "target.mode", "default": "append", "validset": ["append", "overwrite"] }Valid configuration:
source:
format: "csv" # OK
target:
mode: "append" # OKInvalid configuration:
source:
format: "xml" # raises InvalidValueParameterExceptionError message:
Property 'source.format' ('csv', 'json', 'parquet') has invalid value 'xml'
Each entry in validset can also be a regex pattern. The value is tested against each entry — first as an exact match, then as a regex.
{ "name": "source.path", "validset": [r"^/landing/", r"^/bronze/"] }Valid:
source:
path: "/landing/prod/customers/2026-05-11" # matches ^/landing/Invalid:
source:
path: "/silver/customers" # raises InvalidValueParameterException{ "name": "source.format", "validset": ["csv", "json", r"^parquet.*$"] }This allows "csv", "json", or any string starting with "parquet" (e.g., "parquet_snappy").
import yaml
from pyjeb import control_and_setup
from pyjeb.exception import InvalidValueParameterException
controls = [
{ "name": "source", "type": "dict" },
{ "name": "source.path" },
{ "name": "source.format", "validset": ["csv", "json", "parquet"] },
{ "name": "source.pattern", "default": "*" },
{ "name": "target", "type": "dict" },
{ "name": "target.path" },
{ "name": "target.mode", "default": "append", "validset": ["append", "overwrite"] },
{ "name": "enabled", "type": "boolean", "default": True },
{ "name": "max_retries", "type": "integer", "default": 3 },
{ "name": "threshold", "type": "decimal", "default": 0.95 },
{ "name": "tags", "type": "list", "default": [] },
]
job_config = {
"source": { "path": "/landing/prod/customers", "format": "xml" },
"target": { "path": "/bronze/prod/customers" }
}
try:
job = control_and_setup(job_config, controls)
except InvalidValueParameterException as e:
print(e)
# Property 'source.format' ('csv', 'json', 'parquet') has invalid value 'xml'