From e49d5abae7969f4cb504093b75178777399a4c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de> Date: Thu, 17 Apr 2025 01:26:11 +0200 Subject: [PATCH] Add nullability to MediaProcessField --- api/api_specification.json | 12 +++++++++++- api/api_specification.md | 14 ++++++++++++-- api/api_specification_template.md | 7 ++++++- .../media_process/media_process.py | 17 +++++++++++++++-- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/api/api_specification.json b/api/api_specification.json index 5e4a0d8..c9dc81f 100644 --- a/api/api_specification.json +++ b/api/api_specification.json @@ -3057,7 +3057,17 @@ "type": "int" } }, - "media_process": {}, + "media_process": { + "may_be_null": { + "config_directly_modifiable": false, + "id": "may_be_null", + "notes": "", + "object_variant": "media_process", + "only_mod": false, + "optional": false, + "type": "boolean" + } + }, "object": { "may_be_null": { "config_directly_modifiable": false, diff --git a/api/api_specification.md b/api/api_specification.md index 26849ce..b26b976 100644 --- a/api/api_specification.md +++ b/api/api_specification.md @@ -1,4 +1,4 @@ -# Specification of the Web API for the Video-AG Website (v0.79). +# Specification of the Web API for the Video-AG Website (v0.80). ## Introduction @@ -2262,7 +2262,12 @@ Additionally, the following objects may appear as the type of some field: <td>?int</td> <td></td> </tr> - <tr><td><code>media_process</code></td></tr> + <tr> + <td rowspan="1"><code>media_process</code></td> + <td>may_be_null</td> + <td>boolean</td> + <td></td> + </tr> <tr> <td rowspan="2"><code>object</code></td> <td>may_be_null</td> @@ -3183,6 +3188,11 @@ Possible `error_code`: ## Changelog +### v0.80 + +* Updated `field_description` + * Added `may_be_null` for type `media_process` + ### 0.79 * Added `POST /job/status` diff --git a/api/api_specification_template.md b/api/api_specification_template.md index b0ae25c..2098757 100644 --- a/api/api_specification_template.md +++ b/api/api_specification_template.md @@ -1,4 +1,4 @@ -# Specification of the Web API for the Video-AG Website (v0.79). +# Specification of the Web API for the Video-AG Website (v0.80). ## Introduction @@ -139,6 +139,11 @@ Possible `error_code`: ## Changelog +### v0.80 + +* Updated `field_description` + * Added `may_be_null` for type `media_process` + ### 0.79 * Added `POST /job/status` diff --git a/common_py/src/videoag_common/media_process/media_process.py b/common_py/src/videoag_common/media_process/media_process.py index 354a948..debcf5d 100644 --- a/common_py/src/videoag_common/media_process/media_process.py +++ b/common_py/src/videoag_common/media_process/media_process.py @@ -1,5 +1,5 @@ from collections.abc import Iterable -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Any from videoag_common.miscellaneous import * from videoag_common.database import * @@ -99,11 +99,19 @@ class MediaProcess(JsonDataClass): return self._hash +class MediaProcessFieldDescription(ApiFieldDescription): + may_be_null: bool + + @classmethod + def get_type(cls) -> str: + return "media_process" + + class ApiMediaProcessField[_O: ApiObject](ApiSimpleColumnField[_O]): @classmethod def _get_description_class_or_type(cls) -> ApiFieldDescription or str: - return "media_process" + return MediaProcessFieldDescription def post_init_check(self, context: FieldContext): super().post_init_check(context) @@ -114,6 +122,11 @@ class ApiMediaProcessField[_O: ApiObject](ApiSimpleColumnField[_O]): @property def may_be_none_allowed_for_config_fields(self) -> bool: return True + + def _config_get_description_kwargs(self) -> dict[str, Any]: + return super()._config_get_description_kwargs() | { + "may_be_null": self.may_be_none + } def _db_value_to_json(self, db_value) -> JsonTypes: return db_value -- GitLab