11from typing import Any
22
3- from fastapi import APIRouter , Path , Request
4- from stapi_fastapi .conformance import CORE
3+ from fastapi import APIRouter , Path
54from stapi_fastapi .responses import GeoJSONResponse
65from stapi_pydantic import (
76 Conformance ,
1817
1918
2019class RootRouter (APIRouter ):
21- def __init__ (
22- self ,
23- conformances : list [str ] = [CORE ],
24- name : str = "root" ,
25- openapi_endpoint_name : str = "openapi" ,
26- docs_endpoint_name : str = "swagger_ui_html" ,
27- * args : Any ,
28- ** kwargs : Any ,
29- ) -> None :
20+ def __init__ (self , * args : Any , ** kwargs : Any ) -> None :
3021 super ().__init__ (* args , ** kwargs )
31-
32- self .conformances = conformances
33- self .name = name
34- self .openapi_endpoint_name = openapi_endpoint_name
35- self .docs_endpoint_name = docs_endpoint_name
36- self .product_ids : list [str ] = []
37-
38- # A dict is used to track the product routers so we can ensure
39- # idempotentcy in case a product is added multiple times, and also to
40- # manage clobbering if multiple products with the same product_id are
41- # added.
4222 self .product_routers : dict [str , ProductRouter ] = {}
4323
4424 # Core endpoints
@@ -47,17 +27,29 @@ def __init__(
4727 self .get_root ,
4828 methods = ["GET" ],
4929 tags = ["Core" ],
50- summary = "landing page" ,
51- description = "..." ,
30+ summary = "STAPI root endpoint for API discovery and metadata" ,
31+ description = (
32+ "This endpoint serves as the entry point for API discovery and navigation. "
33+ "Returns the STAPI root endpoint response containing the API's metadata: "
34+ "a unique identifier, descriptive text, implemented conformance classes, "
35+ "and hypermedia links to available resources and documentation."
36+ ),
5237 )
5338
5439 self .add_api_route (
5540 "/conformance" ,
5641 self .get_conformance ,
5742 methods = ["GET" ],
5843 tags = ["Core" ],
59- summary = "information about specifications that this API conforms to" ,
60- description = "A list of all conformance classes specified in a standard that the server conforms to." ,
44+ summary = "List of implemented STAPI and OGC conformance classes" ,
45+ description = (
46+ "Returns a list of conformance classes implemented by this API, following "
47+ "the OGC API Features conformance structure. While the core STAPI "
48+ "conformance classes are already communicated in the root endpoint, "
49+ "OGC API requires this duplicate conformance information at this "
50+ "/conformance endpoint. Includes both STAPI-specific conformance classes "
51+ "(e.g., core, order statuses, searches) and relevant OGC conformance classes."
52+ ),
6153 )
6254
6355 # Orders endpoints - w/o specific {productId}/orders endpoints
@@ -105,32 +97,23 @@ def add_product(self, product: Product, *args: Any, **kwargs: Any) -> None:
10597 product_router = ProductRouter (product , self , * args , ** kwargs )
10698 self .include_router (product_router , prefix = f"/products/{ product .id } " )
10799 self .product_routers [product .id ] = product_router
108- self .product_ids = [* self .product_routers .keys ()]
109100
110- def get_root (self , request : Request ) -> RootResponse :
101+ def get_root (self ) -> RootResponse :
111102 return None # type: ignore
112103
113104 def get_conformance (self ) -> Conformance :
114105 return None # type: ignore
115106
116- def get_products (self , request : Request ) -> ProductsCollection :
107+ def get_products (self ) -> ProductsCollection :
117108 return None # type: ignore
118109
119- def get_orders (self , request : Request ) -> OrderCollection [OrderStatus ]:
110+ def get_orders (self ) -> OrderCollection [OrderStatus ]:
120111 return None # type: ignore
121112
122113 def get_order (
123- self ,
124- request : Request ,
125- order_id : str = Path (alias = "orderId" , description = "local identifier of an order" ),
114+ self , order_id : str = Path (alias = "orderId" , description = "local identifier of an order" )
126115 ) -> Order [OrderStatus ]:
127116 return None # type: ignore
128117
129- def get_order_statuses (
130- self ,
131- order_id : str ,
132- request : Request ,
133- next : str | None = None ,
134- limit : int = 10 ,
135- ) -> OrderStatuses : # type: ignore
118+ def get_order_statuses (self , order_id : str , next : str | None = None , limit : int = 10 ) -> OrderStatuses : # type: ignore
136119 return None # type: ignore
0 commit comments