Add mockapi source files and tests
This commit is contained in:
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user