From 31a2493734bef61f7b551fbdc8ed081e7f515e31 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 22 Mar 2026 21:59:10 +0000 Subject: [PATCH] Add mockapi source files and tests --- src/mockapi/core/spec_loader.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/mockapi/core/spec_loader.py b/src/mockapi/core/spec_loader.py index 4fe592e..c8dd0cc 100644 --- a/src/mockapi/core/spec_loader.py +++ b/src/mockapi/core/spec_loader.py @@ -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 \ No newline at end of file + return None