potiuk commented on code in PR #39055:
URL: https://github.com/apache/airflow/pull/39055#discussion_r1567061989


##########
airflow/www/extensions/init_views.py:
##########
@@ -220,90 +203,100 @@ def resolve(self, operation):
         return _LazyResolution(self.resolve_function_from_operation_id, 
operation_id)
 
 
-class _CustomErrorRequestBodyValidator(RequestBodyValidator):
-    """Custom request body validator that overrides error messages.
-
-    By default, Connextion emits a very generic *None is not of type 'object'*
-    error when receiving an empty request body (with the view specifying the
-    body as non-nullable). We overrides it to provide a more useful message.
-    """
-
-    def validate_schema(self, data, url):
-        if not self.is_null_value_valid and data is None:
-            raise BadRequestProblem(detail="Request body must not be empty")
-        return super().validate_schema(data, url)
+base_paths: list[str] = ["/auth/fab/v1"]  # contains the list of base paths 
that have api endpoints
 
 
-base_paths: list[str] = []  # contains the list of base paths that have api 
endpoints
-
-
-def init_api_error_handlers(app: Flask) -> None:
+def init_api_error_handlers(connexion_app: connexion.FlaskApp) -> None:

Review Comment:
   @RobbeSneyders  - here, I think we need your expert review on error handling 
here:
   
   We had to do custom eror handlng here, because we mix API / webapp in the 
same app and we wanted to handle them differently:
   
   For API "/api/v1" and "/auth/fab" and "/internal/api" - we want to return 
`application/error+json` , for regular web app errors we want to provide custom 
flask-rendered view with Airflow logo and "go back to main" link.
   
   That's why we had t handle errors a bit differently - and handle them on 
both `Flask` and `Connexion` level -  and I am not sure if it's the right 
approach - maybe it can be done better.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to