Metadata-Version: 2.1
Name: FlaskEase
Version: 0.1.9
Summary: Flask extension for creating REST APIs. You get autogenerated OpenAPI spec (with Redoc and Swagger Docs), Request parsing and validations (query, path, body, form and files) and Response validation.
Home-page: https://github.com/zero-shubham/flask-ease
Author: Shubham Biswas
Author-email: shubhambiswas.zero@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Description-Content-Type: text/markdown
Requires-Dist: flask (==1.1.2)
Requires-Dist: pydantic (==1.5.1)

# FlaskEase

[Flask](http://flask.pocoo.org/) extension for creating REST APIs. You get autogenerated OpenAPI spec (with Redoc and Swagger Docs), Request parsing and validations (query, path, body, form and files) and Response validation.

Checkout example [here](https://github.com/zero-shubham/flask-ease/tree/master/example)

## Documentation

Documentation is coming soon :)

## Try Example

<div class="termy">

```console
$ git clone git@github.com:zero-shubham/flask-ease.git
$ cd flask-ease
$ poetry install
$ source "$( poetry env list --full-path )/bin/activate"
$ python example/main.py
```

</div>

Now go to <a href="http://127.0.0.1:5000/docs" class="external-link" target="_blank">http://127.0.0.1:5000/docs</a> to find SwaggerUI docs for your API.

## Simple Usage

```python

# * example/resources/pet.py
from application import (
    my_api,
    Depends,
    HTTPException,
    status
)
from schemas.pet import (
    PetCreationForm,
    PetInResp,
    PetInDB
)
from utils.dependencies import get_current_user
from crud.pet import (
    add_new_pet_to_db
)
from uuid import uuid4


@my_api.post(
    route="/pets",
    response_model=PetInResp,
    tags=["pets"],
    auth_required=True
)
def create_new_pet(
    obj_in: PetCreationForm,
    current_user=Depends(get_current_user)
):
    """
    Add a new pet to DB
    """

    if obj_in.owner != current_user["id"]:
        raise HTTPException(
            status.HTTP_403_FORBIDDEN,
            "You are not authorised for this operation."
        )

    new_pet = add_new_pet_to_db(PetInDB(
        id=uuid4(),
        **obj_in.dict()
    ).dict())
    return new_pet

```

## _For a complete understanding check the example [here](https://github.com/zero-shubham/flask-ease/tree/master/example)_

**~~File-uploads are not yet supported via FlaskEase - to be added soon~~**
**Now with File-upload and Multiform support.**


