Skip to content

Commit

Permalink
Merge pull request #29 from Project-OMOTES/28-add-durationparameter-t…
Browse files Browse the repository at this point in the history
…o-jsonforms-format

add duration parameter to jsonforms format
  • Loading branch information
lfse-slafleur authored Sep 19, 2024
2 parents 5b08630 + 2cfd32b commit ad1399f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ volumes:

services:
omotes-rest:
image: ghcr.io/project-omotes/omotes_rest:1.0.1
image: ghcr.io/project-omotes/omotes_rest:1.0.2
networks:
- omotes
- mapeditor-net
Expand Down
9 changes: 9 additions & 0 deletions src/omotes_rest/rest_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
IntegerParameter,
FloatParameter,
DateTimeParameter,
DurationParameter,
)

import logging
Expand Down Expand Up @@ -165,6 +166,14 @@ def get_workflows_jsonforms_format(self) -> list:
jsonforms_schema["format"] = "date-time"
if _parameter.default:
jsonforms_schema["default"] = _parameter.default.isoformat()
elif isinstance(_parameter, DurationParameter):
jsonforms_schema["type"] = "number"
if _parameter.default:
jsonforms_schema["default"] = _parameter.default.total_seconds()
if _parameter.minimum:
jsonforms_schema["minimum"] = _parameter.minimum.total_seconds()
if _parameter.maximum:
jsonforms_schema["maximum"] = _parameter.maximum.total_seconds()
else:
raise NotImplementedError(
f"Parameter type {type(_parameter)} not supported"
Expand Down

0 comments on commit ad1399f

Please sign in to comment.