flask-hintful-0.0.7
توضیحات
Flask extension for generating restful apis using type hints to automatically (de)serialize parameters and generate openapi docs.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | flask-hintful-0.0.7 |
| نام | flask-hintful |
| نسخه کتابخانه | 0.0.7 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Gabriel Cappelli |
| ایمیل نویسنده | 6148081+GabrielCappelli@users.noreply.github.com |
| آدرس صفحه اصلی | https://github.com/GabrielCappelli/flask-hintful |
| آدرس اینترنتی | https://pypi.org/project/flask-hintful/ |
| مجوز | MIT |
[](https://travis-ci.org/GabrielCappelli/flask-hintful)
[](https://codecov.io/gh/GabrielCappelli/flask-hintful)
[](https://flask-hintful.readthedocs.io/en/latest/?badge=latest)
# Flask-Hintful
Flask-Hintful helps you write Restful APIs using Flask by taking advantage of Python's type hints.
Includes support for serializing/deserializing parameters according to type hints and automatically generating OpenApi documentation for your registered routes.
## Requirements
* Python 3.7+
* Flask
* Marshmallow < 3
## Installation
Install using pip
```pip install flask-hintful```
## Quick Start
Construct a FlaskHintful object by passing the Flask application as a parameter, then use the FlaskHintful object `@route` and `.register_blueprint` to register routes.
Create your view functions with type hints and FlaskHintful will serialize pass path args, query args and even the request body for you.
```python
from dataclasses import dataclass
from datetime import date, datetime
from flask import Flask
from flask_hintful import FlaskHintful
app = Flask('My API')
api = FlaskHintful(app)
@dataclass
class NestedModel():
str_field: str
@dataclass
class DataclassModel():
str_field: str
int_field: int
float_field: float
boolean_field: bool
list_field: list
date_field: date
datetime_field: datetime
nested_field: NestedModel
@api.route('/<id>/dataclass_test', methods=['POST'])
def dataclass_route(id: str, query_arg: int, model: DataclassModel) -> DataclassModel:
'''my dataclass route'''
return model
app.run()
```
You will be able to access the generated OpenApi on `/swagger`.

## Documentation
https://flask-hintful.readthedocs.io/
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
نیازمندی
| مقدار | نام |
|---|---|
| >=1.0.2 | flask |
| >=0.0.6 | openapi-specgen |
| >=3.0.0 | marshmallow |
نحوه نصب
نصب پکیج whl flask-hintful-0.0.7:
pip install flask-hintful-0.0.7.whl
نصب پکیج tar.gz flask-hintful-0.0.7:
pip install flask-hintful-0.0.7.tar.gz