flexmeasures.api.common.schemas.generic_assets
Classes
- class flexmeasures.api.common.schemas.generic_assets.AssetIdField(*, strict: bool = False, **kwargs)
Field that represents a generic asset ID. It de-serializes from the asset id to an asset instance.
- _deserialize(asset_id: int, attr, obj, **kwargs) GenericAsset
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.
- _serialize(asset: GenericAsset, attr, data, **kwargs) int
Return a string if self.as_string=True, otherwise return this field’s num_type.