Skip to main content

fullapi

Spec-driven FastAPI: generate a project from api.yaml, then enforce it in CI.

PyPI Python Downloads Status License

Why

Every FastAPI project ends up with the same folder layout, the same CRUD routes, the same Pydantic models copied and renamed. fullapi generates that from one api.yaml file instead. The part that actually matters is check: it fails CI the moment the running app stops matching the spec, so the spec stays true instead of turning into documentation nobody trusts.

Install

pip install fullapi

Needs Python 3.9 or newer.

Setup

Start with a spec file. Either write api.yaml by hand or run:

fullapi init

which drops a starter file you can edit. A minimal spec looks like this:

name: shop_api
database: sqlite        # none | sqlite | postgres
auth: jwt                # optional
resources:
  - name: product
    fields:
      title: str
      price: float
      note: str?         # trailing ? marks the field optional
    auth: true            # protect this resource's routes

Each entry under resources becomes a full CRUD resource: a database model, request and response schemas, and the routes to create, read, update, and delete it.

Generate and run

fullapi gen                       # api.yaml -> ./app
pip install -r requirements.txt
uvicorn app.main:app --reload

gen writes a working FastAPI project into ./app (or wherever you point -o). At this point you have a normal FastAPI codebase: read it, extend it, add your own routes alongside the generated ones.

Keep it honest

As the project grows, the code and the spec can drift apart. Someone renames a field, drops a route, or makes something required without touching api.yaml. check catches that:

fullapi check                     # exits non-zero on breaking changes

Wire it into CI and a spec/app mismatch fails the build instead of shipping quietly.

Commands

Command Description
fullapi init [spec] Write a starter api.yaml
fullapi gen [spec] [-o dir] Generate the project from the spec
fullapi check [spec] [--app app.main:app] Fail on breaking drift from the spec

How check works

It imports your live app and calls its real app.openapi() method, the same schema FastAPI would serve at /openapi.json, then compares that against what api.yaml says should exist. A route or field that disappeared, a type that changed, or a field that became required without a matching spec change: all of that counts as breaking and exits non-zero. New routes and new optional fields are safe and don't fail the build.

Built and maintained by @sahilnyk.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fullapi-2.1.2.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fullapi-2.1.2-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file fullapi-2.1.2.tar.gz.

File metadata

  • Download URL: fullapi-2.1.2.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for fullapi-2.1.2.tar.gz
Algorithm Hash digest
SHA256 c9cf4735beeeea423b22d571612ae13b29bbfd00bfb65bda1af1cba84b78ef88
MD5 84f82753e86150ea79df1f1d25cf923b
BLAKE2b-256 f11e374846e2583be10fc019791435050828e61e6ec1bf9c167c577e756c9657

See more details on using hashes here.

File details

Details for the file fullapi-2.1.2-py3-none-any.whl.

File metadata

  • Download URL: fullapi-2.1.2-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.12

File hashes

Hashes for fullapi-2.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c06e31f02e8d1a75628cd634101f636ab2811ec45a5cdd2abb3703e10476d04b
MD5 f53880a43086621aa7e8f5bdd33fcc69
BLAKE2b-256 dc8fa024fd95349394decba6eaeadad0374e6ca44a67a22a5ebcfcd15c65224b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.2 This release

2 files

2.1.1

2 files

2.1.0

2 files

1.2.1

2 files

1.1.1

2 files

1.1.0

2 files

1.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page