|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | import warnings |
4 | | -from typing import Union, Optional |
| 4 | +from typing import Union, Optional, List |
5 | 5 |
|
6 | 6 |
|
7 | 7 | class Parameter: |
@@ -61,14 +61,25 @@ def datacube(cls, name: str = "data", description: str = "A data cube.") -> Para |
61 | 61 | return cls(name=name, description=description, schema={"type": "object", "subtype": "datacube"}) |
62 | 62 |
|
63 | 63 | @classmethod |
64 | | - def string(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED, values=None) -> Parameter: |
| 64 | + def string( |
| 65 | + cls, |
| 66 | + name: str, |
| 67 | + description: str = None, |
| 68 | + default=_DEFAULT_UNDEFINED, |
| 69 | + values: Optional[List[str]] = None, |
| 70 | + subtype: Optional[str] = None, |
| 71 | + format: Optional[str] = None, |
| 72 | + ) -> Parameter: |
65 | 73 | """Helper to create a 'string' type parameter.""" |
66 | 74 | schema = {"type": "string"} |
67 | 75 | if values is not None: |
68 | 76 | schema["enum"] = values |
| 77 | + if subtype: |
| 78 | + schema["subtype"] = subtype |
| 79 | + if format: |
| 80 | + schema["format"] = format |
69 | 81 | return cls(name=name, description=description, schema=schema, default=default) |
70 | 82 |
|
71 | | - |
72 | 83 | @classmethod |
73 | 84 | def integer(cls, name: str, description: str = None, default=_DEFAULT_UNDEFINED) -> Parameter: |
74 | 85 | """Helper to create a 'integer' type parameter.""" |
|
0 commit comments