Skip to content

Commit

Permalink
Merge pull request #68 from ecmwf-projects/COPDS-797-inject-endpoints…
Browse files Browse the repository at this point in the history
…-doc

Implement mechanism to define custom endpoints descriptions
  • Loading branch information
mcucchi9 authored Sep 16, 2024
2 parents ae0f149 + 297354b commit 25a40ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ogc_api_processes_fastapi/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
class BaseClient(abc.ABC):
"""Defines a pattern for implementing OGC API - Processes endpoints."""

endpoints_description: Dict[str, str] = {
"GetLandingPage": "Get landing page",
"GetConformance": "Get conformance classes",
"GetProcesses": "Get all available processes",
"GetProcess": "Get description of the process",
"PostProcessExecution": "Post request for execution of the process",
"GetJobs": "Get the list of submitted jobs",
"GetJob": "Get status information of the job",
"GetJobResults": "Get results of the job",
"DeleteJob": "Cancel the job",
}

@abc.abstractmethod
def get_processes(
self, limit: Optional[int] = fastapi.Query(None)
Expand Down
1 change: 1 addition & 0 deletions ogc_api_processes_fastapi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def register_route(
route_endpoint = endpoints.create_endpoint(route_name, client=client)
router.add_api_route(
name=route_name,
description=client.endpoints_description.get(route_name, ""),
response_model=response_model,
response_model_exclude_unset=True,
response_model_exclude_none=True,
Expand Down

0 comments on commit 25a40ae

Please sign in to comment.