Skip to main content

This project provides collection of standard schemas for FastAPI framework as: startDate, endDate, offset, limit, etc.

Project description

GitHub GitHub Workflow Status (with branch) Coverage PyPI - Downloads PyPI

Introduction

This project provides collection of commonly used schemas for FastAPI.

Quick Start

This section shows how to use the utilities provided by this project:

from fastapi import FastAPI
from surquest.fastapi.schemas.args import Args

app = FastAPI()

@app.get("/users")
async def get_users(
        offset: Args.offset().type_ = Args.offset().query,
        limit: Args.limit().type_ = Args.limit().query,
):
    return [{
        "id": 1,
        "name": "John Doe"
    }]

Local development

You are more than welcome to contribute to this project. To make your start easier we have prepared a docker image with all the necessary tools to run it as interpreter for Pycharm or to run tests.

Build docker image

docker build `
     --tag surquest/fastapi/schemas `
     --file package.base.dockerfile `
     --target test .

Run tests

docker run --rm -it `
 -v "${pwd}:/opt/project" `
 -w "/opt/project/test" `
 surquest/fastapi/schemas pytest

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page