jmcarp / jmcarp/flask-apispec

Empty kwargs when implementing the example code from the docs

Open
#220 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
652
Forks
151
PR merge metrics
No merged PRs in 30d

Description

I have posted this issue to StackOverflow:

https://stackoverflow.com/questions/67574137/flask-apispec-not-populating-kwargs-with-values-from-get-query-implementation-o

The following simple program below, which is nearly identical to the example provided in the docs, does not work:

```
import flask
from flask_apispec import use_kwargs
from webargs import fields

app = flask.Flask(__name__)

@app.route('/pets', methods=["GET"])
@use_kwargs({'species': fields.Str()})
def list_pets(**kwargs):
assert False, kwargs # NO DATA HERE

if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)
```

The `kwargs` field is empty.

This is with flask v1.1.2.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided program and the @use_kwargs entry point, running the example with Flask 1.1.2 and a GET request containing the species query parameter. Compare its behavior with the documentation example; done means the parsed query value is available in kwargs instead of an empty dictionary.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.