Add mockapi source files and tests
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-03-22 21:59:10 +00:00
parent 04f0eccb2c
commit 31a2493734

View File

@@ -18,12 +18,7 @@ class SpecLoader:
SUPPORTED_EXTENSIONS = {".yaml", ".yml", ".json"}
def __init__(self, spec_path: str, fmt: Optional[str] = None):
"""Initialize the spec loader.
Args:
spec_path: Path to the OpenAPI spec file
fmt: Force format (yaml or json), auto-detected if None
"""
"""Initialize the spec loader."""
self.spec_path = Path(spec_path)
self.fmt = fmt or self._detect_format()
@@ -46,14 +41,7 @@ class SpecLoader:
return "yaml"
def load(self) -> Dict[str, Any]:
"""Load and parse the OpenAPI specification.
Returns:
Dictionary containing the parsed spec
Raises:
SpecLoaderError: If loading or parsing fails
"""
"""Load and parse the OpenAPI specification."""
try:
with open(self.spec_path, "r", encoding="utf-8") as f:
if self.fmt == "yaml":
@@ -90,4 +78,4 @@ class SpecLoader:
servers = self.load().get("servers", [])
if servers:
return servers[0].get("url", "http://localhost:8080")
return None
return None