From 0a5789130c61fafc33b864714552766b5cf4edb0 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Sun, 22 Mar 2026 21:59:18 +0000 Subject: [PATCH] Add mockapi source files and tests --- src/mockapi/core/request_validator.py | 29 ++++----------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/mockapi/core/request_validator.py b/src/mockapi/core/request_validator.py index 2c919df..f302bb9 100644 --- a/src/mockapi/core/request_validator.py +++ b/src/mockapi/core/request_validator.py @@ -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 @@ -124,4 +103,4 @@ class ValidationMiddleware(BaseHTTPMiddleware): }, ) - return await call_next(request) \ No newline at end of file + return await call_next(request)