flowserv.model.parameter.record module

Declarations for record parameter values. Records are collections of parameters. Each component (field) of a record is identified by a unique name.

class flowserv.model.parameter.record.Record(name: str, fields: List[flowserv.model.parameter.base.Parameter], index: Optional[int] = 0, label: Optional[str] = None, help: Optional[str] = None, default: Optional[Dict] = None, required: Optional[bool] = False, group: Optional[str] = None)

Bases: flowserv.model.parameter.base.Parameter

Record parameter type that associates parameter declarations for record components with unique keys.

cast(value: Any) Dict

Convert the given value into a record. Returns a dictionary that is a mapping of filed identifier to the converted values returned by the respective parameter declaration.

Expects a list of dictionaries containing two elements: ‘name’ and ‘value’. The name identifies the record field and the value is the argument value for that field.

Raises an error if the value is not a list, if any of the dictionaries are not well-formed, if required fields are not present in the given list, or if the respective parameter declaration for a record fields raised an exception during cast.

Parameters

value (any) – User-provided value for a template parameter.

Return type

sting

Raises

flowserv.error.InvalidArgumentError

static from_dict(doc: Dict, validate: Optional[bool] = True) flowserv.model.parameter.record.Record

Get record parameter instance from a given dictionary serialization.

Parameters
  • doc (dict) – Dictionary serialization for record parameter declaration.

  • validate (bool, default=True) – Validate the serialized object if True.

Return type

flowserv.model.parameter.record.Record

Raises

flowserv.error.InvalidParameterError

to_dict() Dict

Get dictionary serialization for the parameter declaration. Adds list of serialized parameter declarations for record fields to the base serialization.

Individual fields are serialized as dictionaries with elements ‘name’ for the field name and ‘para’ for the serialized parameter declaration.

Return type

dict