@@ -496,6 +496,7 @@ async def collection_dggrs_description(
496496 collections : Annotated [Dict [str , Collection ], Depends (_get_collection )],
497497 dggrs_provider = Depends (_get_dggrs_provider )
498498) -> Union [DggrsDescription , Response ]:
499+ # the collections should hold all collections defined or the colllection specified by the path variable
499500 dggrs_description = dggrs .model_copy (deep = True )
500501 current_url = str (req .url )
501502 col_id = getattr (dggrs_req , "collectionId" , None )
@@ -541,6 +542,9 @@ async def collection_dggrs_zone_info(
541542 collections : Dict [str , Collection ] = Depends (_get_collection ),
542543 collection_provider : Dict [str , AbstractCollectionProvider ] = Depends (_get_collection_provider ),
543544) -> Union [ZoneInfoResponse , Response ]:
545+ # the collections should hold all collections defined or the colllection specified by the path variable
546+ if (len (collections .keys ()) == 0 ):
547+ raise HTTPException (status_code = 404 , detail = f"f'{ __name__ } query zones info, there are no collections for querying" )
544548 try :
545549 info = query_zone_info (zoneinfoReq , req .url , dggrs_description , dggrs_provider , collections , collection_provider )
546550 except ValueError as e :
@@ -591,6 +595,9 @@ async def collection_list_dggrs_zones(
591595 collection_provider : Annotated [Dict [str , AbstractCollectionProvider ], Depends (_get_collection_provider )],
592596) -> Union [ZonesResponse , ZonesGeoJson , Response ]:
593597
598+ # the collections should hold all collections defined or the colllection specified by the path variable
599+ if (len (collections .keys ()) == 0 ):
600+ raise HTTPException (status_code = 404 , detail = f"f'{ __name__ } query zones list, there are no collections for querying" )
594601 returntype = _get_return_type (req , zone_query_support_returntype , zone_query_support_formats , 'application/json' )
595602 returngeometry = zonesReq .geometry if (zonesReq .geometry is not None ) else 'zone-region'
596603 zone_level = zonesReq .zone_level
@@ -692,6 +699,10 @@ async def collection_dggrs_zones_data(
692699 collections : Dict [str , Collection ] = Depends (_get_collection ),
693700 collection_provider : Dict [str , CollectionProvider ] = Depends (_get_collection_provider ),
694701) -> ZonesDataDggsJsonResponse | FileResponse | Response :
702+
703+ # the collections should hold all collections defined or the colllection specified by the path variable
704+ if (len (collections .keys ()) == 0 ):
705+ raise HTTPException (status_code = 404 , detail = f"f'{ __name__ } query zones data, there are no collections for querying" )
695706 returntype = _get_return_type (req , zone_data_support_returntype , zone_data_support_formats , 'application/json' )
696707 zoneId = zonedataReq .zoneId
697708 depth = zonedataQuery .zone_depth if (zonedataQuery .zone_depth is not None ) else [dggrs_description .defaultDepth ]
0 commit comments