28 lines
669 B
Python
28 lines
669 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Route:
|
|
controller: str
|
|
handler: str
|
|
raw_path: str
|
|
http_method: str
|
|
metadata: dict[str, str]
|
|
header: Path
|
|
|
|
@property
|
|
def operation_id(self) -> str:
|
|
return f"{self.controller}.{self.handler}"
|
|
|
|
|
|
@dataclass
|
|
class InferredOperation:
|
|
path_parameters: list[dict[str, Any]] = field(default_factory=list)
|
|
query_parameters: list[dict[str, Any]] = field(default_factory=list)
|
|
request_schema: dict[str, Any] | None = None
|
|
response_schema: dict[str, Any] | None = None
|