Commit bd57ee23 authored by Dimitrios Gogos's avatar Dimitrios Gogos
Browse files

feat: add API versioning to schemas and implement tests for OpenAPI metadata

parent b81c6852
Loading
Loading
Loading
Loading
+2 −0
Changes for src/open_exposure_gateway/api/camara/edge_application_management/v0_1_0_alpha_1/schemas.py: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ from pydantic import (
    field_validator,
)

SOURCE_API_VERSION = "0.1.0-alpha.1"

_CAMARA_UUID_PATTERN = re.compile(
    r"^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
)
+2 −0
Changes for src/open_exposure_gateway/api/gsma/federation_manager/v1_4_0/schemas.py: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@ from uuid import UUID

from pydantic import BaseModel, Field, StringConstraints, model_validator

SOURCE_API_VERSION = "1.4.0"

# --- Scalar types (OpenAPI: string/integer with pattern or format) -------------

# "^[A-Za-z0-9][A-Za-z0-9-]*$" is shared by FederationContextId, FederationIdentifier
+24 −0
Changes for src/open_exposure_gateway/main.py: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -49,15 +49,27 @@ from open_exposure_gateway.adapters.http.traffic_influence_callback_client impor
from open_exposure_gateway.api.camara.edge_application_management.v0_1_0_alpha_1.router import (
    router as edge_application_management_router,
)
from open_exposure_gateway.api.camara.edge_application_management.v0_1_0_alpha_1.schemas import (
    SOURCE_API_VERSION as EAM_API_VERSION,
)
from open_exposure_gateway.api.camara.location_retrieval.v0_5_0.router import (
    router as location_retrieval_router,
)
from open_exposure_gateway.api.camara.location_retrieval.v0_5_0.schemas import (
    SOURCE_API_VERSION as LOCATION_API_VERSION,
)
from open_exposure_gateway.api.camara.quality_on_demand.v1_1_0.router import (
    router as quality_on_demand_router,
)
from open_exposure_gateway.api.camara.quality_on_demand.v1_1_0.schemas import (
    SOURCE_API_VERSION as QOD_API_VERSION,
)
from open_exposure_gateway.api.camara.traffic_influence.v0_10_0.router import (
    router as traffic_influence_router,
)
from open_exposure_gateway.api.camara.traffic_influence.v0_10_0.schemas import (
    SOURCE_API_VERSION as TRAFFIC_API_VERSION,
)
from open_exposure_gateway.api.error_handlers import (
    register_exception_handlers,
    x_correlator_header,
@@ -65,6 +77,9 @@ from open_exposure_gateway.api.error_handlers import (
from open_exposure_gateway.api.gsma.federation_manager.v1_4_0.router import (
    router as federation_manager_router,
)
from open_exposure_gateway.api.gsma.federation_manager.v1_4_0.schemas import (
    SOURCE_API_VERSION as FEDERATION_API_VERSION,
)
from open_exposure_gateway.api.platform.health import router as health_router
from open_exposure_gateway.application.callback_secrets import (
    purge_expired_callback_credentials,
@@ -389,18 +404,22 @@ def _build_qod_operation_status_handler(
openapi_tags = [
    {
        "name": "Application",
        "x-api-version": EAM_API_VERSION,
        "description": "Application and Application Instance Life Cycle Management",
    },
    {
        "name": "Edge Cloud",
        "x-api-version": EAM_API_VERSION,
        "description": "Edge Cloud Zones Availability",
    },
    {
        "name": "Cluster",
        "x-api-version": EAM_API_VERSION,
        "description": "Kubernetes Cluster information",
    },
    {
        "name": "QoS Sessions",
        "x-api-version": QOD_API_VERSION,
        "description": "Manage QoS sessions",
    },
    {
@@ -409,22 +428,27 @@ openapi_tags = [
    },
    {
        "name": "Location retrieval",
        "x-api-version": LOCATION_API_VERSION,
        "description": "Retrieve the location of a device",
    },
    {
        "name": "Traffic Influence API read",
        "x-api-version": TRAFFIC_API_VERSION,
        "description": "Reads existing TrafficInfluence resources",
    },
    {
        "name": "Traffic Influence API write",
        "x-api-version": TRAFFIC_API_VERSION,
        "description": "Creates or modifies a TrafficInfluence resource",
    },
    {
        "name": "Federation Manager",
        "x-api-version": FEDERATION_API_VERSION,
        "description": "GSMA OPG Federation Management (EWBI) -- partner federation lifecycle",
    },
    {
        "name": "Availability Zone Info Synchronization",
        "x-api-version": FEDERATION_API_VERSION,
        "description": "GSMA OPG availability-zone subscription and resource reservation",
    },
    {