diff --git a/documentation/changelog.rst b/documentation/changelog.rst index ceabcb7002..e271bd5501 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -29,6 +29,7 @@ Infrastructure / Support Bugfixes ----------- +* Allow flex-model and flex-context to be missing from scheduling requests, because by now the whole flex-config can be defined on assets (in the db) instead [see `PR #2237 `_] * Let storage scheduling treat missing constant SoC bounds as unconstrained lower or upper bounds [see `PR #2221 `_] * Allow root assets belonging to different accounts to share the same name, while keeping asset names unique among root assets within the same account and among children of the same parent [see `PR #2226 `_] diff --git a/flexmeasures/api/v3_0/assets.py b/flexmeasures/api/v3_0/assets.py index 60a7c29bda..11d7ddb441 100644 --- a/flexmeasures/api/v3_0/assets.py +++ b/flexmeasures/api/v3_0/assets.py @@ -106,7 +106,7 @@ def __init__(self, *args, **kwargs): flex_context = fields.Nested( flex_context_schema_openAPI, - required=True, + load_default={}, data_key="flex-context", metadata=dict( description="The flex-context is validated according to the scheduler's `FlexContextSchema`.", @@ -115,11 +115,11 @@ def __init__(self, *args, **kwargs): flex_model = fields.List( fields.Nested( storage_flex_model_schema_openAPI(exclude=["asset"]), - required=True, - data_key="flex-model", - metadata=dict( - description="Flex-model per device (identified by `sensor`). The flex-model validation is handled by the scheduler. What follows is the schema used by the `StorageScheduler`.", - ), + ), + load_default=[], + data_key="flex-model", + metadata=dict( + description="Flex-model per device (identified by `sensor`). The flex-model may (partly) also be defined on the asset, and sending it here overrides those settings for the schedule at hand. The flex-model validation is handled by the scheduler. What follows is the schema used by the `StorageScheduler`.", ), ) diff --git a/flexmeasures/ui/static/openapi-specs.json b/flexmeasures/ui/static/openapi-specs.json index fd62b861ac..af48a5cc66 100644 --- a/flexmeasures/ui/static/openapi-specs.json +++ b/flexmeasures/ui/static/openapi-specs.json @@ -6255,14 +6255,16 @@ "example": "PT2H", "format": "duration" }, - "flex_model": { + "flex-model": { "type": "array", + "default": [], + "description": "Flex-model per device (identified by `sensor`). The flex-model may (partly) also be defined on the asset, and sending it here overrides those settings for the schedule at hand. The flex-model validation is handled by the scheduler. What follows is the schema used by the `StorageScheduler`.", "items": { - "description": "Flex-model per device (identified by `sensor`). The flex-model validation is handled by the scheduler. What follows is the schema used by the `StorageScheduler`.", "$ref": "#/components/schemas/StorageFlexModelSchemaOpenAPI" } }, "flex-context": { + "default": {}, "description": "The flex-context is validated according to the scheduler's `FlexContextSchema`.", "$ref": "#/components/schemas/FlexContextOpenAPISchema" }, @@ -6277,7 +6279,6 @@ } }, "required": [ - "flex-context", "start" ], "additionalProperties": false