flask-openapi3 icon indicating copy to clipboard operation
flask-openapi3 copied to clipboard

AttributeError: 'function' object has no attribute 'validate_response'

Open renew010101 opened this issue 1 month ago • 0 comments

Environment: As follow up for MR #225 , please make the code more defensive:

AttributeError: 'function' object has no attribute 'validate_response'

is caused by

if func.validate_response is not None:
    _validate_response = func.validate_response
else:
    _validate_response = self.validate_response

please change to:

_validate_response = getattr(func, "validate_response", None) or getattr(self, "validate_response", None)

to make more defensive. This gives issues when upgrading from 4.2.x to 4.3

renew010101 avatar Nov 05 '25 11:11 renew010101