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:18 +00:00
parent 0a28cc443a
commit 0a5789130c

View File

@@ -19,12 +19,7 @@ class RequestValidator:
"""Validates incoming requests against OpenAPI spec."""
def __init__(self, spec: Dict[str, Any], strict: bool = False):
"""Initialize the request validator.
Args:
spec: OpenAPI specification
strict: Enable strict validation mode
"""
"""Initialize the request validator."""
self.spec = spec
self.strict = strict
@@ -36,18 +31,7 @@ class RequestValidator:
headers: Dict[str, str],
body: Optional[Any] = None,
) -> Tuple[bool, List[Dict[str, Any]]]:
"""Validate a request against the spec.
Args:
method: HTTP method
path: Request path
query_params: Query parameters
headers: Request headers
body: Request body
Returns:
Tuple of (is_valid, errors)
"""
"""Validate a request against the spec."""
errors = []
path_params = self._extract_path_params(method, path)
@@ -97,12 +81,7 @@ class ValidationMiddleware(BaseHTTPMiddleware):
"""Middleware that validates requests."""
def __init__(self, app, validator: RequestValidator):
"""Initialize the validation middleware.
Args:
app: The ASGI application
validator: RequestValidator instance
"""
"""Initialize the validation middleware."""
super().__init__(app)
self.validator = validator