Skip to content

Enable configurable API metadata #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions ogc_api_processes_fastapi/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""API routes registration and initialization."""

import typing
from typing import Callable
from typing import Any, Callable

import fastapi
import pydantic
Expand Down Expand Up @@ -60,8 +60,26 @@ def instantiate_app(
exception_handler: Callable[
[fastapi.Request, exceptions.OGCAPIException], fastapi.responses.JSONResponse
] = exceptions.ogc_api_exception_handler,
**kwargs: Any,
) -> fastapi.FastAPI:
app = fastapi.FastAPI()
"""Instantiate FastAPI application.

Parameters
----------
client : clients.BaseClient
Client to be used for API requests.
exception_handler : Callable[[fastapi.Request, exceptions.OGCAPIException],
fastapi.responses.JSONResponse], optional
Exception handler, by default exceptions.ogc_api_exception_handler
**kwargs : Any
Additional parameters passed to `fastapi.Fastapi()`.

Returns
-------
fastapi.FastAPI
FastAPI application.
"""
app = fastapi.FastAPI(**kwargs)
router = instantiate_router(client)
app.include_router(router)
app = exceptions.include_exception_handlers(app, exception_handler)
Expand Down
20 changes: 10 additions & 10 deletions ogc_api_processes_fastapi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class AdditionalParameter(pydantic.BaseModel):


class JobControlOptions(enum.Enum):
sync_execute: str = "sync-execute"
async_execute: str = "async-execute"
dismiss: str = "dismiss"
sync_execute = "sync-execute"
async_execute = "async-execute"
dismiss = "dismiss"


class TransmissionMode(enum.Enum):
value: str = "value"
reference: str = "reference"
value = "value"
reference = "reference"


class PaginationQueryParameters(pydantic.BaseModel):
Expand Down Expand Up @@ -260,11 +260,11 @@ class ProcessDescription(ProcessSummary):


class StatusCode(str, enum.Enum):
accepted: str = "accepted"
running: str = "running"
successful: str = "successful"
failed: str = "failed"
dismissed: str = "dismissed"
accepted = "accepted"
running = "running"
successful = "successful"
failed = "failed"
dismissed = "dismissed"


class JobType(enum.Enum):
Expand Down