Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checking parameter type #110

Merged
merged 1 commit into from
Nov 9, 2023

Commits on Nov 1, 2023

  1. Fix checking parameter type

    Workaround for a bug in flask-pydantic.
    
    Avoids the following exception causing server to respond with HTTP 500:
    
        Traceback (most recent call last):
        File "/venv/lib64/python3.11/site-packages/flask_pydantic/core.py", line 197, in wrapper
            b = body_model(**body_params)
                ^^^^^^^^^^^^^^^^^^^^^^^^^
        TypeError: resultsdb.parsers.api_v3.BrewResultParams() argument after ** must be a mapping, not str
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
        File "/venv/lib64/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
            response = self.full_dispatch_request()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/venv/lib64/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
            rv = self.handle_user_exception(e)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/venv/lib64/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
            rv = self.dispatch_request()
                ^^^^^^^^^^^^^^^^^^^^^^^
        File "/venv/lib64/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
            return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/venv/lib64/python3.11/site-packages/flask_pyoidc/flask_pyoidc.py", line 463, in wrapper
            return view_func(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/venv/lib64/python3.11/site-packages/flask_pydantic/core.py", line 204, in wrapper
            raise JsonBodyParsingError()
        flask_pydantic.exceptions.JsonBodyParsingError
    
    Server will respond instead with HTTP 400 and the following JSON body:
    
        {
            "validation_error": {
                "body_params": [{
                    "loc": ["__root__"],
                    "msg": "value is not a valid dict",
                    "type": "type_error.dict"
                }]
            }
        }
    
    JIRA: RHELWF-10108
    hluk committed Nov 1, 2023
    Configuration menu
    Copy the full SHA
    75f9dd7 View commit details
    Browse the repository at this point in the history