|
15 | 15 |
|
16 | 16 | class ComputeQuerySchema(Schema): |
17 | 17 | keys = fields.String( |
18 | | - required=True, description="Keys identifying dataset, in order" |
| 18 | + required=True, metadata={"description": "Keys identifying dataset, in order"} |
19 | 19 | ) |
20 | | - tile_z = fields.Int(required=True, description="Requested zoom level") |
21 | | - tile_y = fields.Int(required=True, description="y coordinate") |
22 | | - tile_x = fields.Int(required=True, description="x coordinate") |
| 20 | + tile_z = fields.Int(required=True, metadata={"description": "Requested zoom level"}) |
| 21 | + tile_y = fields.Int(required=True, metadata={"description": "y coordinate"}) |
| 22 | + tile_x = fields.Int(required=True, metadata={"description": "x coordinate"}) |
23 | 23 |
|
24 | 24 |
|
25 | 25 | def _operator_field(i: int) -> fields.String: |
26 | | - return fields.String(description=f"Last key of variable v{i} in given expression.") |
| 26 | + return fields.String( |
| 27 | + metadata={"description": f"Last key of variable v{i} in given expression."} |
| 28 | + ) |
27 | 29 |
|
28 | 30 |
|
29 | 31 | class ComputeOptionSchema(Schema): |
30 | 32 | class Meta: |
31 | 33 | unknown = EXCLUDE |
32 | 34 |
|
33 | 35 | expression = fields.String( |
34 | | - description="Mathematical expression to execute.", |
35 | | - example="(v1 - v2) / (v1 + v2)", |
| 36 | + metadata={ |
| 37 | + "description": "Mathematical expression to execute.", |
| 38 | + "example": "(v1 - v2) / (v1 + v2)", |
| 39 | + }, |
36 | 40 | required=True, |
37 | 41 | ) |
38 | 42 |
|
39 | 43 | stretch_range = fields.List( |
40 | | - fields.Number(allow_none=True), |
| 44 | + fields.Float(allow_none=True), |
41 | 45 | validate=validate.Length(equal=2), |
42 | | - example="[0,1]", |
43 | | - description="Stretch range to use as JSON array.", |
| 46 | + metadata={ |
| 47 | + "description": "Stretch range to use as JSON array.", |
| 48 | + "example": "[0,1]", |
| 49 | + }, |
44 | 50 | required=True, |
45 | 51 | ) |
46 | 52 |
|
47 | 53 | colormap = fields.String( |
48 | | - description="Colormap to apply to image (see /colormap).", |
| 54 | + metadata={"description": "Colormap to apply to image (see /colormap)."}, |
49 | 55 | validate=validate.OneOf(("explicit", *AVAILABLE_CMAPS)), |
50 | | - missing=None, |
| 56 | + load_default=None, |
51 | 57 | ) |
52 | 58 |
|
53 | 59 | tile_size = fields.List( |
54 | 60 | fields.Integer(), |
55 | 61 | validate=validate.Length(equal=2), |
56 | | - example="[256,256]", |
57 | | - description="Pixel dimensions of the returned PNG image as JSON list.", |
| 62 | + metadata={ |
| 63 | + "description": "Pixel dimensions of the returned PNG image as JSON list.", |
| 64 | + "example": "[256,256]", |
| 65 | + }, |
58 | 66 | ) |
59 | 67 |
|
60 | 68 | v1 = _operator_field(1) |
@@ -111,7 +119,7 @@ def get_compute(tile_z: int, tile_y: int, tile_x: int, keys: str = "") -> Respon |
111 | 119 |
|
112 | 120 | class ComputePreviewSchema(Schema): |
113 | 121 | keys = fields.String( |
114 | | - required=True, description="Keys identifying dataset, in order" |
| 122 | + required=True, metadata={"description": "Keys identifying dataset, in order"} |
115 | 123 | ) |
116 | 124 |
|
117 | 125 |
|
|
0 commit comments