-
Notifications
You must be signed in to change notification settings - Fork 39
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
Support for Pydantic #234
Comments
👋 There has been some discussion/interest around adding support for Pydantic. Will have a look at flask_pydantic - would be awesome if we can leverage what they've already built without reinventing the wheel and I see there's discussion over there around adding OpenAPI generation (bauerji/flask-pydantic#17) so potentially a nice win-win for both projects! |
Personally, I don't think flask-rebar should aim to support Pydantic. I think this would be trying to do too many things. Flask-rebar is mostly a little glue between the real heavy-lifters: Flask, Marshmallow, and OpenAPI. If you remove this glue, I'm not sure how much code is actually left in Flask-rebar. In other words, the majority of code in Flask-rebar is a specific to Marshmallow - Marshmallow validation/marshaling integration, conversion between Marshmallow schemas and OpenAPI, etc. Instead, I think we should aim for better support for type annotations. Flask-rebar was written several years ago and was intended to support Python 2. As Python 2 itself is no longer supported and type annotations are becoming standard, I think we can give Flask-rebar a typing facelift. When it comes to typed request/response objects, perhaps we should stick with something based on Marshmallow. There are some existing packages out there: But both of those are pretty small, so it could also make sense to roll our own instead of taking on an additional dependency. tldr: |
I'm actually planning to add type annotations (+ mypy support?) as my next ADSK hack week project |
This seems a solid foundation. It would be awesome if you added support for using Pydantic schemas and/or using Typing annotations. Starting stone here (https://github.com/bauerji/flask_pydantic). Is this something you would be interested in?
The text was updated successfully, but these errors were encountered: