def validate(self, request): try: path, operation, _, path_result, _ = self._find_path(request) # don't process if operation errors except PathError as exc: return RequestValidationResult(errors=[ exc, ]) try: security = self._get_security(request, operation) except InvalidSecurity as exc: return RequestValidationResult(errors=[ exc, ]) request.parameters.path = request.parameters.path or \ path_result.variables params, params_errors = self._get_parameters(request, path, operation) body, body_errors = self._get_body(request, operation) errors = params_errors + body_errors return RequestValidationResult( errors=errors, body=body, parameters=params, security=security, )
def _validate_parameters(self, request): try: path, operation, _, path_result, _ = self._find_path(request) except PathError as exc: return RequestValidationResult(errors=[ exc, ]) request.parameters.path = request.parameters.path or \ path_result.variables operation_params = operation.get('parameters', []) operation_params_iter = operation_params and \ iter(operation_params) or [] path_params = path.get('parameters', []) params_params_iter = path_params and \ iter(path_params) or [] params, params_errors = self._get_parameters( request, chain( operation_params_iter, params_params_iter, )) return RequestValidationResult( errors=params_errors, parameters=params, )
def validate(self, request): try: _, operation, _, _, _ = self._find_path(request.method, request.full_url_pattern) except PathError as exc: return RequestValidationResult(errors=[exc]) try: body = self._get_body(request, operation) except ( MissingRequiredRequestBody, MediaTypeFinderError, DeserializeError, CastError, ValidateError, UnmarshalError, ) as exc: body = None errors = [exc] except MissingRequestBody: body = None errors = [] else: errors = [] return RequestValidationResult( errors=errors, body=body, )
def _validate_body(self, request): try: _, operation, _, _, _ = self._find_path(request) except PathError as exc: return RequestValidationResult(errors=[ exc, ]) body, body_errors = self._get_body(request, operation) return RequestValidationResult( errors=body_errors, body=body, )
def validate(self, request): try: _, operation, _, _, _ = self._find_path(request.method, request.full_url_pattern) except PathError as exc: return RequestValidationResult(errors=[exc]) body, body_errors = self._get_body(request, operation) return RequestValidationResult( errors=body_errors, body=body, )
def validate(self, request): try: path, operation, _, path_result, _ = self._find_path( request.method, request.full_url_pattern) # don't process if operation errors except PathError as exc: return RequestValidationResult(errors=[exc]) try: security = self._get_security(request, operation) except InvalidSecurity as exc: return RequestValidationResult(errors=[exc]) request.parameters.path = (request.parameters.path or path_result.variables) try: params = self._get_parameters(request, path, operation) except ParametersError as exc: params = exc.parameters params_errors = exc.context else: params_errors = [] try: body = self._get_body(request, operation) except ( MissingRequiredRequestBody, MediaTypeFinderError, DeserializeError, CastError, ValidateError, UnmarshalError, ) as exc: body = None body_errors = [exc] except MissingRequestBody: body = None body_errors = [] else: body_errors = [] errors = params_errors + body_errors return RequestValidationResult( errors=errors, body=body, parameters=params, security=security, )
def validate(self, request): try: _, operation, _, _, _ = self._find_path(request.method, request.full_url_pattern) except PathError as exc: return RequestValidationResult(errors=[exc]) try: security = self._get_security(request, operation) except InvalidSecurity as exc: return RequestValidationResult(errors=[exc]) return RequestValidationResult( errors=[], security=security, )
def validate(self, request): try: path, operation, _, path_result, _ = self._find_path( request.method, request.full_url_pattern) except PathError as exc: return RequestValidationResult(errors=[exc]) request.parameters.path = (request.parameters.path or path_result.variables) params, params_errors = self._get_parameters(request, path, operation) return RequestValidationResult( errors=params_errors, parameters=params, )
def validate(self, request): try: path, operation, _, path_result, _ = self._find_path(request) except PathError as exc: return RequestValidationResult(errors=[ exc, ]) request.parameters.path = request.parameters.path or \ path_result.variables params, params_errors = self._get_parameters(request, path, operation) return RequestValidationResult( errors=params_errors, parameters=params, )
def _validate_parameters(self, request): try: path, operation, _, path_result, _ = self._find_path(request) except PathError as exc: return RequestValidationResult(errors=[ exc, ]) request.parameters.path = request.parameters.path or \ path_result.variables params, params_errors = self._get_parameters( request, chain(iteritems(operation.parameters), iteritems(path.parameters))) return RequestValidationResult( errors=params_errors, parameters=params, )
def validate(self, request): try: path, operation, _, path_result, _ = self._find_path(request) # don't process if operation errors except PathError as exc: return RequestValidationResult(errors=[ exc, ]) try: security = self._get_security(request, operation) except InvalidSecurity as exc: return RequestValidationResult(errors=[ exc, ]) request.parameters.path = request.parameters.path or \ path_result.variables operation_params = operation.get('parameters', []) operation_params_iter = operation_params and \ iter(operation_params) or [] path_params = path.get('parameters', []) params_params_iter = path_params and \ iter(path_params) or [] params, params_errors = self._get_parameters( request, chain( operation_params_iter, params_params_iter, )) body, body_errors = self._get_body(request, operation) errors = params_errors + body_errors return RequestValidationResult( errors=errors, body=body, parameters=params, security=security, )
def validate(self, request): try: server = self.spec.get_server(request.full_url_pattern) # don't process if server errors except InvalidServer as exc: return RequestValidationResult([ exc, ], None, None) operation_pattern = get_operation_pattern(server.default_url, request.full_url_pattern) try: path = self.spec[operation_pattern] except InvalidPath as exc: return RequestValidationResult([ exc, ], None, None) try: operation = self.spec.get_operation(operation_pattern, request.method) # don't process if operation errors except InvalidOperation as exc: return RequestValidationResult([ exc, ], None, None) params, params_errors = self._get_parameters( request, chain(iteritems(operation.parameters), iteritems(path.parameters))) body, body_errors = self._get_body(request, operation) errors = params_errors + body_errors return RequestValidationResult(errors, body, params)