marshmallow-code / marshmallow-code/flask-smorest
Best way to pass jwt credentials and query args to schema
- Dominant language
- Python
- Stars
- 717
- Forks
- 77
- Avg merge
- 7h 49m
- Merged PRs (30d)
- 3
Description
Hello, thank you for your really nice job! I am using your framework and enjoying a lot.
I would like to ask you if it is possible to pass jwt credentials and query args to the schema defined in arguments. For example, I have:
```python
@bp.route('/users/')
class UserById(MethodView):
@jwt_required
@bp.arguments(UserEditSchema)
@bp.response(UserEditSchema)
def put(self, args, id):
username = get_jwt_identity()
logged_user = User.get_by_username(username)
user = User.query.get(id)
```
The thing is that I want to check if user == logged_user inside UserEditSchema
Thank you!
Contributor guide
Research direction
Start at the UserById.put entry point and compare how @jwt_required and @bp.arguments pass context to UserEditSchema. Determine whether JWT identity and the route/query values should be available during schema handling, then define focused coverage and document the supported usage or limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100