flexmeasures.data.schemas.generic_assets
Classes
- class flexmeasures.data.schemas.generic_assets.GenericAssetIdField(*args, **kwargs)
Field that deserializes to a GenericAsset and serializes back to an integer.
- _deserialize(value, attr, obj, **kwargs) GenericAsset
Turn a generic asset id into a GenericAsset.
- _serialize(asset, attr, data, **kwargs)
Turn a GenericAsset into a generic asset id.
- class flexmeasures.data.schemas.generic_assets.GenericAssetSchema(*args, **kwargs)
GenericAsset schema, with validations.
- class Meta
- model
alias of
GenericAsset
- opts: SchemaOpts = <flask_marshmallow.sqla.SQLAlchemySchemaOpts object>
- class flexmeasures.data.schemas.generic_assets.GenericAssetTypeSchema(*args, **kwargs)
GenericAssetType schema, with validations.
- class Meta
- model
alias of
GenericAssetType
- opts: SchemaOpts = <flask_marshmallow.sqla.SQLAlchemySchemaOpts object>
- class flexmeasures.data.schemas.generic_assets.JSON(*, load_default: typing.Any = <marshmallow.missing>, missing: typing.Any = <marshmallow.missing>, dump_default: typing.Any = <marshmallow.missing>, default: typing.Any = <marshmallow.missing>, data_key: str | None = None, attribute: str | None = None, validate: None | typing.Callable[[typing.Any], typing.Any] | typing.Iterable[typing.Callable[[typing.Any], typing.Any]] = None, required: bool = False, allow_none: bool | None = None, load_only: bool = False, dump_only: bool = False, error_messages: dict[str, str] | None = None, metadata: typing.Mapping[str, typing.Any] | None = None, **additional_metadata)
- _deserialize(value, attr, data, **kwargs) dict
Deserialize value. Concrete
Field
classes should implement this method.- Parameters:
value – The value to be deserialized.
attr – The attribute/key in data to be deserialized.
data – The raw input data passed to the Schema.load.
kwargs – Field-specific keyword arguments.
- Raises:
ValidationError – In case of formatting or validation failure.
- Returns:
The deserialized value.
Changed in version 2.0.0: Added
attr
anddata
parameters.Changed in version 3.0.0: Added
**kwargs
to signature.