@@ -146,8 +146,15 @@ class BaseFactory(metaclass=abc.ABCMeta):
146
146
147
147
extensions : List [FactoryExtension ] = field (factory = list )
148
148
149
+ name : Optional [str ] = field (default = None )
150
+ operation_prefix : str = field (init = False , default = "" )
151
+
149
152
def __attrs_post_init__ (self ):
150
153
"""Post Init: register route and configure specific options."""
154
+ # prefix for endpoint's operationId
155
+ name = self .name or self .router_prefix .replace ("/" , "." )
156
+ self .operation_prefix = f"{ name } ." if name else ""
157
+
151
158
# Register endpoints
152
159
self .register_routes ()
153
160
@@ -334,6 +341,7 @@ def bounds(self):
334
341
"/bounds" ,
335
342
response_model = Bounds ,
336
343
responses = {200 : {"description" : "Return dataset's bounds." }},
344
+ operation_id = f"{ self .operation_prefix } getBounds" ,
337
345
)
338
346
def bounds (
339
347
src_path = Depends (self .path_dependency ),
@@ -362,6 +370,7 @@ def info(self):
362
370
response_model_exclude_none = True ,
363
371
response_class = JSONResponse ,
364
372
responses = {200 : {"description" : "Return dataset's basic info." }},
373
+ operation_id = f"{ self .operation_prefix } getInfo" ,
365
374
)
366
375
def info (
367
376
src_path = Depends (self .path_dependency ),
@@ -384,6 +393,7 @@ def info(
384
393
"description" : "Return dataset's basic info as a GeoJSON feature." ,
385
394
}
386
395
},
396
+ operation_id = f"{ self .operation_prefix } getInfoGeoJSON" ,
387
397
)
388
398
def info_geojson (
389
399
src_path = Depends (self .path_dependency ),
@@ -421,6 +431,7 @@ def statistics(self):
421
431
"description" : "Return dataset's statistics." ,
422
432
}
423
433
},
434
+ operation_id = f"{ self .operation_prefix } getStatistics" ,
424
435
)
425
436
def statistics (
426
437
src_path = Depends (self .path_dependency ),
@@ -462,6 +473,7 @@ def statistics(
462
473
"description" : "Return dataset's statistics from feature or featureCollection." ,
463
474
}
464
475
},
476
+ operation_id = f"{ self .operation_prefix } postStatisticsForGeoJSON" ,
465
477
)
466
478
def geojson_statistics (
467
479
geojson : Annotated [
@@ -538,6 +550,7 @@ def tilesets(self):
538
550
}
539
551
},
540
552
summary = "Retrieve a list of available raster tilesets for the specified dataset." ,
553
+ operation_id = f"{ self .operation_prefix } getTileSetList" ,
541
554
)
542
555
async def tileset_list (
543
556
request : Request ,
@@ -623,6 +636,7 @@ async def tileset_list(
623
636
response_model_exclude_none = True ,
624
637
responses = {200 : {"content" : {"application/json" : {}}}},
625
638
summary = "Retrieve the raster tileset metadata for the specified dataset and tiling scheme (tile matrix set)." ,
639
+ operation_id = f"{ self .operation_prefix } getTileSet" ,
626
640
)
627
641
async def tileset (
628
642
request : Request ,
@@ -751,15 +765,24 @@ async def tileset(
751
765
def tile (self ): # noqa: C901
752
766
"""Register /tiles endpoint."""
753
767
754
- @self .router .get (r"/tiles/{tileMatrixSetId}/{z}/{x}/{y}" , ** img_endpoint_params )
755
768
@self .router .get (
756
- r"/tiles/{tileMatrixSetId}/{z}/{x}/{y}.{format}" , ** img_endpoint_params
769
+ "/tiles/{tileMatrixSetId}/{z}/{x}/{y}" ,
770
+ operation_id = f"{ self .operation_prefix } getTile" ,
771
+ ** img_endpoint_params ,
772
+ )
773
+ @self .router .get (
774
+ "/tiles/{tileMatrixSetId}/{z}/{x}/{y}.{format}" ,
775
+ operation_id = f"{ self .operation_prefix } getTileWithFormat" ,
776
+ ** img_endpoint_params ,
757
777
)
758
778
@self .router .get (
759
- r"/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x" , ** img_endpoint_params
779
+ "/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x" ,
780
+ operation_id = f"{ self .operation_prefix } getTileWithScale" ,
781
+ ** img_endpoint_params ,
760
782
)
761
783
@self .router .get (
762
- r"/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x.{format}" ,
784
+ "/tiles/{tileMatrixSetId}/{z}/{x}/{y}@{scale}x.{format}" ,
785
+ operation_id = f"{ self .operation_prefix } getTileWithFormatAndScale" ,
763
786
** img_endpoint_params ,
764
787
)
765
788
def tile (
@@ -844,6 +867,7 @@ def tilejson(self): # noqa: C901
844
867
response_model = TileJSON ,
845
868
responses = {200 : {"description" : "Return a tilejson" }},
846
869
response_model_exclude_none = True ,
870
+ operation_id = f"{ self .operation_prefix } getTileJSON" ,
847
871
)
848
872
def tilejson (
849
873
request : Request ,
@@ -927,7 +951,11 @@ def tilejson(
927
951
def map_viewer (self ): # noqa: C901
928
952
"""Register /map.html endpoint."""
929
953
930
- @self .router .get ("/{tileMatrixSetId}/map.html" , response_class = HTMLResponse )
954
+ @self .router .get (
955
+ "/{tileMatrixSetId}/map.html" ,
956
+ response_class = HTMLResponse ,
957
+ operation_id = f"{ self .operation_prefix } getMapViewer" ,
958
+ )
931
959
def map_viewer (
932
960
request : Request ,
933
961
tileMatrixSetId : Annotated [
@@ -993,7 +1021,9 @@ def wmts(self): # noqa: C901
993
1021
"""Register /wmts endpoint."""
994
1022
995
1023
@self .router .get (
996
- "/{tileMatrixSetId}/WMTSCapabilities.xml" , response_class = XMLResponse
1024
+ "/{tileMatrixSetId}/WMTSCapabilities.xml" ,
1025
+ response_class = XMLResponse ,
1026
+ operation_id = f"{ self .operation_prefix } getWMTS" ,
997
1027
)
998
1028
def wmts (
999
1029
request : Request ,
@@ -1135,10 +1165,11 @@ def point(self):
1135
1165
"""Register /point endpoints."""
1136
1166
1137
1167
@self .router .get (
1138
- r "/point/{lon},{lat}" ,
1168
+ "/point/{lon},{lat}" ,
1139
1169
response_model = Point ,
1140
1170
response_class = JSONResponse ,
1141
1171
responses = {200 : {"description" : "Return a value for a point" }},
1172
+ operation_id = f"{ self .operation_prefix } getDataForPoint" ,
1142
1173
)
1143
1174
def point (
1144
1175
lon : Annotated [float , Path (description = "Longitude" )],
@@ -1151,7 +1182,6 @@ def point(
1151
1182
env = Depends (self .environment_dependency ),
1152
1183
):
1153
1184
"""Get Point value for a dataset."""
1154
-
1155
1185
with rasterio .Env (** env ):
1156
1186
with self .reader (src_path , ** reader_params .as_dict ()) as src_dst :
1157
1187
pts = src_dst .point (
@@ -1174,8 +1204,16 @@ def point(
1174
1204
def preview (self ):
1175
1205
"""Register /preview endpoint."""
1176
1206
1177
- @self .router .get (r"/preview" , ** img_endpoint_params )
1178
- @self .router .get (r"/preview.{format}" , ** img_endpoint_params )
1207
+ @self .router .get (
1208
+ "/preview" ,
1209
+ operation_id = f"{ self .operation_prefix } getPreview" ,
1210
+ ** img_endpoint_params ,
1211
+ )
1212
+ @self .router .get (
1213
+ "/preview.{format}" ,
1214
+ operation_id = f"{ self .operation_prefix } getPreviewWithFormat" ,
1215
+ ** img_endpoint_params ,
1216
+ )
1179
1217
def preview (
1180
1218
format : Annotated [
1181
1219
ImageType ,
@@ -1224,10 +1262,12 @@ def part(self): # noqa: C901
1224
1262
# GET endpoints
1225
1263
@self .router .get (
1226
1264
"/bbox/{minx},{miny},{maxx},{maxy}.{format}" ,
1265
+ operation_id = f"{ self .operation_prefix } getDataForBoundingBox" ,
1227
1266
** img_endpoint_params ,
1228
1267
)
1229
1268
@self .router .get (
1230
1269
"/bbox/{minx},{miny},{maxx},{maxy}/{width}x{height}.{format}" ,
1270
+ operation_id = f"{ self .operation_prefix } getDataForBoundingBoxWithSizesAndFormat" ,
1231
1271
** img_endpoint_params ,
1232
1272
)
1233
1273
def bbox_image (
@@ -1279,14 +1319,17 @@ def bbox_image(
1279
1319
# POST endpoints
1280
1320
@self .router .post (
1281
1321
"/feature" ,
1322
+ operation_id = f"{ self .operation_prefix } postDataForGeoJSON" ,
1282
1323
** img_endpoint_params ,
1283
1324
)
1284
1325
@self .router .post (
1285
1326
"/feature.{format}" ,
1327
+ operation_id = f"{ self .operation_prefix } postDataForGeoJSONWithFormat" ,
1286
1328
** img_endpoint_params ,
1287
1329
)
1288
1330
@self .router .post (
1289
1331
"/feature/{width}x{height}.{format}" ,
1332
+ operation_id = f"{ self .operation_prefix } postDataForGeoJSONWithSizesAndFormat" ,
1290
1333
** img_endpoint_params ,
1291
1334
)
1292
1335
def feature_image (
@@ -1370,6 +1413,7 @@ def info(self):
1370
1413
"description" : "Return dataset's basic info or the list of available assets."
1371
1414
}
1372
1415
},
1416
+ operation_id = f"{ self .operation_prefix } getInfo" ,
1373
1417
)
1374
1418
def info (
1375
1419
src_path = Depends (self .path_dependency ),
@@ -1393,6 +1437,7 @@ def info(
1393
1437
"description" : "Return dataset's basic info as a GeoJSON feature." ,
1394
1438
}
1395
1439
},
1440
+ operation_id = f"{ self .operation_prefix } getInfoGeoJSON" ,
1396
1441
)
1397
1442
def info_geojson (
1398
1443
src_path = Depends (self .path_dependency ),
@@ -1418,6 +1463,7 @@ def info_geojson(
1418
1463
"/assets" ,
1419
1464
response_model = List [str ],
1420
1465
responses = {200 : {"description" : "Return a list of supported assets." }},
1466
+ operation_id = f"{ self .operation_prefix } getAssets" ,
1421
1467
)
1422
1468
def available_assets (
1423
1469
src_path = Depends (self .path_dependency ),
@@ -1445,6 +1491,7 @@ def statistics(self): # noqa: C901
1445
1491
"description" : "Return dataset's statistics." ,
1446
1492
}
1447
1493
},
1494
+ operation_id = f"{ self .operation_prefix } getAssetsStatistics" ,
1448
1495
)
1449
1496
def asset_statistics (
1450
1497
src_path = Depends (self .path_dependency ),
@@ -1480,6 +1527,7 @@ def asset_statistics(
1480
1527
"description" : "Return dataset's statistics." ,
1481
1528
}
1482
1529
},
1530
+ operation_id = f"{ self .operation_prefix } getStatistics" ,
1483
1531
)
1484
1532
def statistics (
1485
1533
src_path = Depends (self .path_dependency ),
@@ -1525,6 +1573,7 @@ def statistics(
1525
1573
"description" : "Return dataset's statistics from feature or featureCollection." ,
1526
1574
}
1527
1575
},
1576
+ operation_id = f"{ self .operation_prefix } postStatisticsForGeoJSON" ,
1528
1577
)
1529
1578
def geojson_statistics (
1530
1579
geojson : Annotated [
@@ -1615,6 +1664,7 @@ def info(self):
1615
1664
response_model_exclude_none = True ,
1616
1665
response_class = JSONResponse ,
1617
1666
responses = {200 : {"description" : "Return dataset's basic info." }},
1667
+ operation_id = f"{ self .operation_prefix } getInfo" ,
1618
1668
)
1619
1669
def info (
1620
1670
src_path = Depends (self .path_dependency ),
@@ -1638,6 +1688,7 @@ def info(
1638
1688
"description" : "Return dataset's basic info as a GeoJSON feature." ,
1639
1689
}
1640
1690
},
1691
+ operation_id = f"{ self .operation_prefix } getInfoGeoJSON" ,
1641
1692
)
1642
1693
def info_geojson (
1643
1694
src_path = Depends (self .path_dependency ),
@@ -1663,6 +1714,7 @@ def info_geojson(
1663
1714
"/bands" ,
1664
1715
response_model = List [str ],
1665
1716
responses = {200 : {"description" : "Return a list of supported bands." }},
1717
+ operation_id = f"{ self .operation_prefix } getBands" ,
1666
1718
)
1667
1719
def available_bands (
1668
1720
src_path = Depends (self .path_dependency ),
@@ -1689,6 +1741,7 @@ def statistics(self): # noqa: C901
1689
1741
"description" : "Return dataset's statistics." ,
1690
1742
}
1691
1743
},
1744
+ operation_id = f"{ self .operation_prefix } getStatistics" ,
1692
1745
)
1693
1746
def statistics (
1694
1747
src_path = Depends (self .path_dependency ),
@@ -1734,6 +1787,7 @@ def statistics(
1734
1787
"description" : "Return dataset's statistics from feature or featureCollection." ,
1735
1788
}
1736
1789
},
1790
+ operation_id = f"{ self .operation_prefix } postStatisticsForGeoJSON" ,
1737
1791
)
1738
1792
def geojson_statistics (
1739
1793
geojson : Annotated [
@@ -1798,11 +1852,11 @@ def register_routes(self):
1798
1852
"""Register TMS endpoint routes."""
1799
1853
1800
1854
@self .router .get (
1801
- r "/tileMatrixSets" ,
1855
+ "/tileMatrixSets" ,
1802
1856
response_model = TileMatrixSetList ,
1803
1857
response_model_exclude_none = True ,
1804
1858
summary = "Retrieve the list of available tiling schemes (tile matrix sets)." ,
1805
- operation_id = " getTileMatrixSetsList" ,
1859
+ operation_id = f" { self . operation_prefix } getTileMatrixSetsList" ,
1806
1860
responses = {
1807
1861
200 : {
1808
1862
"content" : {
@@ -1843,7 +1897,7 @@ async def tilematrixsets(request: Request):
1843
1897
response_model = TileMatrixSet ,
1844
1898
response_model_exclude_none = True ,
1845
1899
summary = "Retrieve the definition of the specified tiling scheme (tile matrix set)." ,
1846
- operation_id = " getTileMatrixSet" ,
1900
+ operation_id = f" { self . operation_prefix } getTileMatrixSet" ,
1847
1901
responses = {
1848
1902
200 : {
1849
1903
"content" : {
@@ -1923,7 +1977,7 @@ def metadata(algorithm: BaseAlgorithm) -> AlgorithmMetadata:
1923
1977
"/algorithms" ,
1924
1978
response_model = Dict [str , AlgorithmMetadata ],
1925
1979
summary = "Retrieve the list of available Algorithms." ,
1926
- operation_id = "getAlgorithms " ,
1980
+ operation_id = f" { self . operation_prefix } getAlgorithmList " ,
1927
1981
)
1928
1982
def available_algorithms (request : Request ):
1929
1983
"""Retrieve the list of available Algorithms."""
@@ -1933,7 +1987,7 @@ def available_algorithms(request: Request):
1933
1987
"/algorithms/{algorithmId}" ,
1934
1988
response_model = AlgorithmMetadata ,
1935
1989
summary = "Retrieve the metadata of the specified algorithm." ,
1936
- operation_id = " getAlgorithm" ,
1990
+ operation_id = f" { self . operation_prefix } getAlgorithm" ,
1937
1991
)
1938
1992
def algorithm_metadata (
1939
1993
algorithm : Annotated [
@@ -1960,7 +2014,7 @@ def register_routes(self): # noqa: C901
1960
2014
response_model = ColorMapsList ,
1961
2015
response_model_exclude_none = True ,
1962
2016
summary = "Retrieve the list of available colormaps." ,
1963
- operation_id = "getColorMaps " ,
2017
+ operation_id = f" { self . operation_prefix } getColorMapList " ,
1964
2018
)
1965
2019
def available_colormaps (request : Request ):
1966
2020
"""Retrieve the list of available colormaps."""
@@ -2002,7 +2056,7 @@ def available_colormaps(request: Request):
2002
2056
"/colorMaps/{colorMapId}" ,
2003
2057
response_model = ColorMapType ,
2004
2058
summary = "Retrieve the colorMap metadata or image." ,
2005
- operation_id = " getColorMap" ,
2059
+ operation_id = f" { self . operation_prefix } getColorMap" ,
2006
2060
responses = {
2007
2061
200 : {
2008
2062
"content" : {
0 commit comments