connexion icon indicating copy to clipboard operation
connexion copied to clipboard

updates to "body" object inside handler also changes flask.request.json

Open rwuebker opened this issue 5 years ago • 1 comments

Description

Hello - I've created a repo to demonstrate this possible bug. Here is a link to my repo.

Expected behaviour

Using swagger 2, when one adds an additional key to the "body" object passed in from flask/connexion, it also updates flask.request.json. For example in the output below you'll notice I add the "status" key to the body object, and this is reflected when I use flask.request.json.

I expect the same when I switch to using the swagger 3 file.

Actual behaviour

Using swagger 3, updates to the "body" object does not update the flask.request.json object. Is there something I'm missing to get the same functionality as swagger 2? Or is this a bug in flask or connexion?

Notice in the output below there is no "status" key in the response.

Steps to reproduce

  1. Clone this repo
  2. pip install -r requirements.txt
  3. run: "python app.py"
  4. Notice the assertion error

Additional info:

Output of the commands: $ python app.py ------running first round with swagger 2 file------- this is body in handler: {'description': 'this is new description'} this is body in secondary function: {'description': 'this is new description', 'status': True} ------running second round with swagger 3 file------ this is body in handler: {'description': 'this is new description'} this is body in secondary function: {'description': 'this is new description'} Traceback (most recent call last): File "app.py", line 89, in run_exercise('swagger3.yaml') File "app.py", line 82, in run_exercise assert data_json == get_updated_data() AssertionError

rwuebker avatar May 01 '20 00:05 rwuebker

Can we get a resolution on this Please?

aadabi avatar May 05 '20 20:05 aadabi

The relevant parts of the code base were change completely for Connexion 3 which will be released tomorrow. Feel free to reopen if you still run into the same issue.

RobbeSneyders avatar Nov 01 '23 17:11 RobbeSneyders