36 Commits
0.0.3 ... 0.0.7

Author SHA1 Message Date
fcf6ca60c4 fix(drone): use AUTH_URL and private index in quality gate
All checks were successful
continuous-integration/drone/tag Build is passing
2026-10-17 04:24:28 +05:30
621f10409e chore(release): 0.0.7
Squash-merge lib-standardisation: adopt repo standards across packaging,
tooling, docs, and CI.

- standardize pyproject.toml (canonical packaging, lint config, extras, GSDFC pydoclint)
- add py.typed marker, modernize type hints and Google-style docstrings
- nest generated docs under docs/lib and docs/mcp; add hand-written wiki
- adopt standard Type A PyPI CI pipeline (tag==version guard + quality gate)
- promote generated CHANGELOG.md; bump version to 0.0.7
2026-10-17 02:16:49 +05:30
c95de5a6e9 bumped up version to 0.0.6 2026-07-19 20:20:42 +05:30
b3f3068f8d auth-fixes (#3)
## Summary

Resolve `{ENV_VAR}` placeholders in the OpenAPI spec before serving it. Replace the monolithic `x-introspect-url` extension with composable `x-server-url` + individual `x-*-path` fields so auth endpoints are configurable per-environment without hardcoding.

## Changes

- **`openapi_first/app.py`** — add `_resolve_spec_env_vars()` that replaces `{ENV_VAR}` patterns (e.g. `{AUTH_SERVER}`) with the corresponding OS environment variable before returning the spec JSON. Called in `__init__` after spec load.
- **`openapi_first/security.py`** — build the introspection URL dynamically from `x-server-url` + `x-introspect-path` extensions on the `bearerAuth` security scheme, instead of reading a single `x-introspect-url`.

## Migration

Existing specs using `x-introspect-url: "https://auth.example.com/introspect"` must switch to the new extension format:

```yaml
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-server-url: "{AUTH_SERVER}"
      x-login-path: "/login"
      x-register-path: "/register"
      x-logout-path: "/logout"
      x-me-path: "/me"
      x-introspect-path: "/introspect"

Reviewed-on: #3
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
2026-07-19 14:47:02 +00:00
7d075b3904 bumped up version
All checks were successful
continuous-integration/drone Build is passing
2026-07-17 12:52:51 +05:30
28c6d9e964 if no ffilterable but autocomplete, thriw error 2026-07-13 04:17:59 +05:30
628c3e97f5 if no ffilterable but autocomplete, thriw error 2026-07-13 04:14:42 +05:30
4bf358734a filterable treatment description 2026-07-13 04:01:50 +05:30
f5b3c2bb11 removed - from phone number 2026-07-13 03:24:05 +05:30
3da419fed5 feat(vet_app): add x-autocomplete annotations to schema fields
- Add x-autocomplete annotations to all qualifying string fields:
  - token: Pet.name, Parent.name, Vet.name, Vet.specialty, Treatment.label, Procedure.name
  - text: Treatment.description, Appointment.notes, Procedure.description
  - email: Parent.email, Vet.email
  - phone: Parent.phone, Vet.phone
2026-07-13 03:22:12 +05:30
a417563ab5 readme and order fixes 2026-07-13 01:36:35 +05:30
1940e33bc7 nested schema fixes 2026-07-12 23:53:42 +05:30
5da0a688a8 allOf and oneOf 2026-07-12 01:19:03 +05:30
f1a7a556fd sse sub resource 2026-07-12 00:51:23 +05:30
4a7a76e330 sse events schema for /calls 2026-06-18 01:52:55 +05:30
083fb6923d sse events sample 2026-06-18 01:21:40 +05:30
69b795f9ca moved procedures field from treatment to appointment and updated schema 2026-06-17 01:25:19 +05:30
61de233745 nested inline schemas 2026-06-17 01:01:35 +05:30
d912053368 fk fixes 2026-06-16 18:41:53 +05:30
0f591b666b seed data 2026-06-16 18:15:43 +05:30
808ffa8fed seed data 2026-06-16 18:02:59 +05:30
1e1d7fcde9 read spec from backend api 2026-06-16 17:58:04 +05:30
d4b64d630a cors fixes 2026-06-16 17:50:36 +05:30
85aac955ac cors fixes 2026-06-16 16:55:05 +05:30
8299445b68 cors fixes 2026-06-16 16:52:01 +05:30
eb845c5bf4 vet app 2026-06-16 12:26:47 +05:30
514f6e5f7c code gen 2026-06-16 04:14:14 +05:30
1c48f58578 updated docs strings and added README.md 2026-03-08 17:59:52 +05:30
80f8defcc2 mcp docs 2026-03-08 00:41:19 +05:30
f03e250763 google styled doc 2026-03-08 00:29:23 +05:30
37b892f695 fixing examples and adding doc strings 2026-02-22 13:17:40 +05:30
14ed19d2d5 module as source doc fixes (#2)
Reviewed-on: #2
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
2026-02-21 16:47:27 +00:00
6bafa435f1 using doc-forge (#1)
Reviewed-on: #1
Co-authored-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
Co-committed-by: Vishesh 'ironeagle' Bangotra <aetoskia@gmail.com>
2026-01-22 11:28:32 +00:00
29c1579f40 v0.0.4 — Documents and packages OpenAPI-first application templates, adds multi-template CLI scaffolding, and enforces package-bound documentation generation.
All checks were successful
continuous-integration/drone/tag Build is passing
2026-01-11 21:44:11 +05:30
a3c063b569 docs(templates): document CRUD and model CRUD apps and expose them in mkdocs
- Add comprehensive module and function docstrings to crud_app and model_app templates
- Document OpenAPI-first guarantees, non-goals, and usage patterns in templates
- Add template-level __init__.py files with CLI and client usage examples
- Update mkdocs.yml to include CRUD and model-based CRUD template documentation
- Ensure template documentation follows strict package-bound mkdocstrings rules
2026-01-11 21:42:30 +05:30
72b5be6976 docs, cli: enforce package-bound docs, add template scaffolding, and document CLI usage
- Restrict mkdocstrings generation to real Python packages (require __init__.py)
- Add explicit documentation section for CLI scaffolding and templates
- Generalize CLI to support multiple templates with dynamic discovery
- Package templates correctly for importlib.resources access
- Add fully documented health_app template (app entry point and handlers)
- Fix setuptools package-data configuration for bundled templates

These changes make documentation import-safe, clarify package boundaries,
and provide a deterministic, OpenAPI-first scaffolding workflow via CLI.
2026-01-11 19:26:21 +05:30
172 changed files with 15661 additions and 677 deletions

View File

@@ -23,20 +23,50 @@ steps:
commands: commands:
- PACKAGE_NAME=$(grep -E '^name\s*=' pyproject.toml | head -1 | cut -d'"' -f2) - PACKAGE_NAME=$(grep -E '^name\s*=' pyproject.toml | head -1 | cut -d'"' -f2)
- VERSION=$(grep -E '^version\s*=' pyproject.toml | head -1 | cut -d'"' -f2) - VERSION=$(grep -E '^version\s*=' pyproject.toml | head -1 | cut -d'"' -f2)
- echo "🔍 Checking if $PACKAGE_NAME==$VERSION exists on $PIP_REPO_URL ..."
- | - |
if curl -fsSL -u "$PIP_USERNAME:$PIP_PASSWORD" "$PIP_REPO_URL/simple/$PACKAGE_NAME/" | grep -q "$VERSION"; then if [ "$DRONE_TAG" != "$VERSION" ]; then
echo "✅ $PACKAGE_NAME==$VERSION already exists — skipping build." echo "Tag '$DRONE_TAG' does not match pyproject version '$VERSION'; refusing to publish."
exit 1
fi
- echo "Checking if $PACKAGE_NAME==$VERSION exists on $PIP_REPO_URL ..."
- |
if curl -fsSL -u "$PIP_USERNAME:$PIP_PASSWORD" "$PIP_REPO_URL/simple/$PACKAGE_NAME/" | grep -qE "${PACKAGE_NAME}-${VERSION}(-|\.tar\.gz|\.whl)"; then
echo "$PACKAGE_NAME==$VERSION already exists; skipping build."
exit 78 exit 78
else else
echo "🆕 New version detected: $PACKAGE_NAME==$VERSION" echo "New version detected: $PACKAGE_NAME==$VERSION"
fi fi
- name: quality-gate
image: python:3.13-slim
environment:
PIP_REPO_URL:
from_secret: PIP_REPO_URL
PIP_USERNAME:
from_secret: PIP_USERNAME
PIP_PASSWORD:
from_secret: PIP_PASSWORD
commands:
- pip install --upgrade pip build
- |
if [ -z "$PIP_REPO_URL" ] || [ -z "$PIP_USERNAME" ] || [ -z "$PIP_PASSWORD" ]; then
echo "PIP_REPO_URL / PIP_USERNAME / PIP_PASSWORD are not set" >&2
exit 1
fi
- AUTH_URL="https://$PIP_USERNAME:$PIP_PASSWORD@$(echo "$PIP_REPO_URL" | sed -E 's|^[a-zA-Z]+://||; s|/*$||')/simple"
- pip install --index-url "$AUTH_URL" --extra-index-url https://pypi.org/simple/ -U ".[dev]" "pydoclint>=0.9.1"
- echo "Running quality gate..."
- python -m black --check .
- python -m ruff check .
- python -m mypy
- pydoclint .
- python -m pytest
- name: build-package - name: build-package
image: python:3.13-slim image: python:3.13-slim
commands: commands:
- pip install --upgrade pip build - pip install --upgrade pip build
- echo "📦 Building Python package..." - echo "Building Python package..."
- python -m build - python -m build
- ls -l dist - ls -l dist
@@ -51,7 +81,7 @@ steps:
from_secret: PIP_PASSWORD from_secret: PIP_PASSWORD
commands: commands:
- pip install --upgrade twine - pip install --upgrade twine
- echo "🚀 Uploading to private PyPI at $PIP_REPO_URL ..." - echo "Uploading to private PyPI at $PIP_REPO_URL ..."
- | - |
twine upload \ twine upload \
--repository-url "$PIP_REPO_URL" \ --repository-url "$PIP_REPO_URL" \
@@ -98,25 +128,31 @@ steps:
set -e set -e
PACKAGE_NAME=$(grep -E '^name\s*=' pyproject.toml | cut -d'"' -f2) PACKAGE_NAME=$(grep -E '^name\s*=' pyproject.toml | cut -d'"' -f2)
echo "📦 Package: $PACKAGE_NAME" echo "Package: $PACKAGE_NAME"
for TAG in $(git tag --sort=version:refname); do for TAG in $(git tag --sort=version:refname); do
VERSION="$TAG" VERSION="$TAG"
echo "🔁 Version: $VERSION" echo "Version: $VERSION"
if curl -fsSL -u "$PIP_USERNAME:$PIP_PASSWORD" \ if curl -fsSL -u "$PIP_USERNAME:$PIP_PASSWORD" \
"$PIP_REPO_URL/simple/$PACKAGE_NAME/" | grep -q "$VERSION"; then "$PIP_REPO_URL/simple/$PACKAGE_NAME/" | grep -qE "${PACKAGE_NAME}-${VERSION}(-|\.tar\.gz|\.whl)"; then
echo "⏭️ Exists, skipping" echo "Exists, skipping"
continue continue
fi fi
git checkout --force "$TAG" git checkout --force "$TAG"
echo "🏗️ Building $VERSION" TAG_VERSION=$(grep -E '^version\s*=' pyproject.toml | head -1 | cut -d'"' -f2)
if [ "$TAG" != "$TAG_VERSION" ]; then
echo "Tag $TAG != pyproject version $TAG_VERSION at that commit; skipping"
continue
fi
echo "Building $VERSION"
rm -rf dist rm -rf dist
python -m build python -m build
echo "⬆️ Uploading $VERSION" echo "Uploading $VERSION"
twine upload \ twine upload \
--repository-url "$PIP_REPO_URL" \ --repository-url "$PIP_REPO_URL" \
-u "$PIP_USERNAME" \ -u "$PIP_USERNAME" \

7
.gitignore vendored
View File

@@ -25,10 +25,17 @@ env/
htmlcov/ htmlcov/
coverage.xml coverage.xml
# Lint / type checking
.mypy_cache/
.ruff_cache/
# Environment variables # Environment variables
.env .env
.env.local .env.local
# Docs build artifacts
site
# OS # OS
.DS_Store .DS_Store
Thumbs.db Thumbs.db

35
CHANGELOG.md Normal file
View File

@@ -0,0 +1,35 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.0.7] - 2026-10-17
### Added
- `py.typed` marker for PEP 561 type information.
- Route code generation: template-style async route stubs with a body parameter
and service hint; resource-name sanitisation; `--inject-request` /
`--package` options; expanded form bodies.
- Type stubs for the `cli`, `codegen`, and `security` modules.
- Hand-written wiki, plus doc-forge-generated API reference under `docs/lib`
and MCP bundle under `docs/mcp` (per-kind MkDocs configs).
- MIT `LICENSE`.
### Changed
- Adopted the standard Type A PyPI CI pipeline: a `tag == version` guard and a
quality gate (black, ruff, mypy, pydoclint, pytest).
- Standardized `pyproject.toml` (canonical packaging, lint tool config, extras)
with a shared Google-style `[tool.pydoclint]` configuration.
- `templates/` excluded from black/ruff scans.
### Fixed
- Binder/app route annotations tightened (FastAPI / `ModuleType`);
`binder.pyi` synced with the signature.
- Stub fixes for typed API surfaces.
[Unreleased]: https://git.aetoskia.com/aetos/openapi-first/compare/0.0.7...HEAD
[0.0.7]: https://git.aetoskia.com/aetos/openapi-first/compare/0.0.6...0.0.7

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Aetoskia Platform
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

96
README.md Normal file
View File

@@ -0,0 +1,96 @@
# openapi_first
# Summary
FastAPI OpenAPI First — strict OpenAPI-first application bootstrap for FastAPI.
FastAPI OpenAPI First is a **contract-first infrastructure library** that
enforces OpenAPI as the single source of truth for FastAPI services.
The library removes decorator-driven routing and replaces it with
deterministic, spec-driven application assembly. Every HTTP route,
method, and operation is defined in OpenAPI first and bound to Python
handlers explicitly via `operationId`.
---
# Installation
Install using pip:
```bash
pip install openapi-first
```
Or with Poetry:
```bash
poetry add openapi-first
```
---
# Quick Start
Minimal OpenAPI-first FastAPI application:
```python
from openapi_first import app
import my_service.routes as routes
api = app.OpenAPIFirstApp(
openapi_path="openapi.yaml",
routes_module=routes,
title="My Service",
version="1.0.0",
)
```
OperationId-driven HTTP client:
```python
from openapi_first.loader import load_openapi
from openapi_first.client import OpenAPIClient
spec = load_openapi("openapi.yaml")
client = OpenAPIClient(spec)
response = client.get_health()
```
---
# Architecture
The library is structured around four core responsibilities:
- `loader`: Load and validate OpenAPI 3.x specifications (JSON/YAML).
- `binder`: Bind OpenAPI operations to FastAPI routes via `operationId`.
- `app`: OpenAPI-first FastAPI application bootstrap.
- `client`: OpenAPI-first HTTP client driven by the same specification.
- `errors`: Explicit error hierarchy for contract violations.
---
# Public API
The supported public API consists of the following top-level modules:
- `openapi_first.app`
- `openapi_first.binder`
- `openapi_first.loader`
- `openapi_first.client`
- `openapi_first.errors`
---
# Design Guarantees
- OpenAPI is the single source of truth.
- No undocumented routes can exist.
- No OpenAPI operation can exist without a handler or client callable.
- All contract violations fail at application startup or client creation.
- No hidden FastAPI magic or implicit behavior.
- Deterministic, testable application assembly.
---

13
docforge.nav.yml Normal file
View File

@@ -0,0 +1,13 @@
home: lib/index.md
groups:
Application Bootstrap:
- lib/app.md
- lib/binder.md
Core Utilities:
- lib/loader.md
- lib/errors.md
OpenAPI Client:
- lib/client.md
icon:
logo: material/api
repo: fontawesome/brands/github

3
docs/lib/codegen.md Normal file
View File

@@ -0,0 +1,3 @@
# Codegen
::: openapi_first.codegen

View File

@@ -0,0 +1,3 @@
# Codegen Routes
::: openapi_first.codegen_routes

4
docs/lib/index.md Normal file
View File

@@ -0,0 +1,4 @@
# openapi_first
::: openapi_first
- [Openapi First](openapi_first/)

View File

@@ -0,0 +1,3 @@
# App
::: openapi_first.app

View File

@@ -0,0 +1,3 @@
# Binder
::: openapi_first.binder

View File

@@ -0,0 +1,3 @@
# Cli
::: openapi_first.cli

View File

@@ -0,0 +1,3 @@
# Client
::: openapi_first.client

View File

@@ -0,0 +1,3 @@
# Codegen
::: openapi_first.codegen

View File

@@ -0,0 +1,3 @@
# Codegen Routes
::: openapi_first.codegen_routes

View File

@@ -0,0 +1,3 @@
# Errors
::: openapi_first.errors

View File

@@ -0,0 +1,13 @@
# Openapi First
::: openapi_first
- [App](app.md)
- [Binder](binder.md)
- [Cli](cli.md)
- [Client](client.md)
- [Codegen](codegen.md)
- [Codegen Routes](codegen_routes.md)
- [Errors](errors.md)
- [Loader](loader.md)
- [Security](security.md)
- [Templates](templates/)

View File

@@ -0,0 +1,3 @@
# Loader
::: openapi_first.loader

View File

@@ -0,0 +1,3 @@
# Security
::: openapi_first.security

View File

@@ -0,0 +1,3 @@
# Data
::: openapi_first.templates.crud_app.data

View File

@@ -0,0 +1,7 @@
# Crud App
::: openapi_first.templates.crud_app
- [Data](data.md)
- [Main](main.md)
- [Routes](routes.md)
- [Test Crud App](test_crud_app.md)

View File

@@ -0,0 +1,3 @@
# Main
::: openapi_first.templates.crud_app.main

View File

@@ -0,0 +1,3 @@
# Routes
::: openapi_first.templates.crud_app.routes

View File

@@ -0,0 +1,3 @@
# Test Crud App
::: openapi_first.templates.crud_app.test_crud_app

View File

@@ -0,0 +1,5 @@
# Health App
::: openapi_first.templates.health_app
- [Main](main.md)
- [Routes](routes.md)

View File

@@ -0,0 +1,3 @@
# Main
::: openapi_first.templates.health_app.main

View File

@@ -0,0 +1,3 @@
# Routes
::: openapi_first.templates.health_app.routes

View File

@@ -0,0 +1,7 @@
# Templates
::: openapi_first.templates
- [Crud App](crud_app/)
- [Health App](health_app/)
- [Model App](model_app/)
- [Vet App](vet_app/)

View File

@@ -0,0 +1,3 @@
# Data
::: openapi_first.templates.model_app.data

View File

@@ -0,0 +1,8 @@
# Model App
::: openapi_first.templates.model_app
- [Data](data.md)
- [Main](main.md)
- [Models](models.md)
- [Routes](routes.md)
- [Test Model App](test_model_app.md)

View File

@@ -0,0 +1,3 @@
# Main
::: openapi_first.templates.model_app.main

View File

@@ -0,0 +1,3 @@
# Models
::: openapi_first.templates.model_app.models

View File

@@ -0,0 +1,3 @@
# Routes
::: openapi_first.templates.model_app.routes

View File

@@ -0,0 +1,3 @@
# Test Model App
::: openapi_first.templates.model_app.test_model_app

View File

@@ -0,0 +1,3 @@
# Data
::: openapi_first.templates.vet_app.data

View File

@@ -0,0 +1,9 @@
# Vet App
::: openapi_first.templates.vet_app
- [Data](data.md)
- [Main](main.md)
- [Models](models.md)
- [Routes](routes.md)
- [Sse](sse.md)
- [Test Vet App](test_vet_app.md)

View File

@@ -0,0 +1,3 @@
# Main
::: openapi_first.templates.vet_app.main

View File

@@ -0,0 +1,3 @@
# Models
::: openapi_first.templates.vet_app.models

View File

@@ -0,0 +1,3 @@
# Routes
::: openapi_first.templates.vet_app.routes

View File

@@ -0,0 +1,3 @@
# Sse
::: openapi_first.templates.vet_app.sse

View File

@@ -0,0 +1,3 @@
# Test Vet App
::: openapi_first.templates.vet_app.test_vet_app

3
docs/lib/security.md Normal file
View File

@@ -0,0 +1,3 @@
# Security
::: openapi_first.security

View File

@@ -0,0 +1,3 @@
# Data
::: openapi_first.templates.crud_app.data

View File

@@ -0,0 +1,3 @@
# Crud App
::: openapi_first.templates.crud_app

View File

@@ -0,0 +1,3 @@
# Main
::: openapi_first.templates.crud_app.main

View File

@@ -0,0 +1,3 @@
# Routes
::: openapi_first.templates.crud_app.routes

View File

@@ -0,0 +1,3 @@
# Test Crud App
::: openapi_first.templates.crud_app.test_crud_app

View File

@@ -0,0 +1,3 @@
# Health App
::: openapi_first.templates.health_app

View File

@@ -0,0 +1,3 @@
# Main
::: openapi_first.templates.health_app.main

View File

@@ -0,0 +1,3 @@
# Routes
::: openapi_first.templates.health_app.routes

View File

@@ -0,0 +1,3 @@
# Templates
::: openapi_first.templates

View File

@@ -0,0 +1,3 @@
# Data
::: openapi_first.templates.model_app.data

View File

@@ -0,0 +1,3 @@
# Model App
::: openapi_first.templates.model_app

View File

@@ -0,0 +1,3 @@
# Main
::: openapi_first.templates.model_app.main

View File

@@ -0,0 +1,3 @@
# Models
::: openapi_first.templates.model_app.models

View File

@@ -0,0 +1,3 @@
# Routes
::: openapi_first.templates.model_app.routes

View File

@@ -0,0 +1,3 @@
# Test Model App
::: openapi_first.templates.model_app.test_model_app

View File

@@ -0,0 +1,3 @@
# Data
::: openapi_first.templates.vet_app.data

View File

@@ -0,0 +1,3 @@
# Vet App
::: openapi_first.templates.vet_app

View File

@@ -0,0 +1,3 @@
# Main
::: openapi_first.templates.vet_app.main

View File

@@ -0,0 +1,3 @@
# Models
::: openapi_first.templates.vet_app.models

View File

@@ -0,0 +1,3 @@
# Routes
::: openapi_first.templates.vet_app.routes

View File

@@ -0,0 +1,3 @@
# Sse
::: openapi_first.templates.vet_app.sse

View File

@@ -0,0 +1,3 @@
# Test Vet App
::: openapi_first.templates.vet_app.test_vet_app

6
docs/mcp/index.json Normal file
View File

@@ -0,0 +1,6 @@
{
"project": "openapi_first",
"type": "docforge-model",
"modules_count": 32,
"source": "docforge"
}

View File

@@ -0,0 +1,53 @@
{
"module": "openapi_first.app",
"content": {
"path": "openapi_first.app",
"docstring": "# Summary\n\nOpenAPI-first application bootstrap for FastAPI.\n\nThis module provides `OpenAPIFirstApp`, a thin but strict abstraction\nthat enforces OpenAPI as the single source of truth for a FastAPI service.\n\nNotes:\n **Core Principles:**\n\n - The OpenAPI specification (JSON or YAML) defines the entire API surface.\n - Every `operationId` in the OpenAPI spec must have a corresponding\n Python handler function.\n - Handlers are plain Python callables (no FastAPI decorators).\n - FastAPI route registration is derived exclusively from the spec.\n - FastAPI's autogenerated OpenAPI schema is fully overridden.\n\n **Responsibilities:**\n\n - Loads and validates an OpenAPI 3.x specification.\n - Dynamically binds HTTP routes to handler functions using `operationId`.\n - Registers routes with FastAPI at application startup.\n - Ensures runtime behavior matches the OpenAPI contract exactly.\n\n **Constraints:**\n\n - This module intentionally does NOT:\n - Generate OpenAPI specs.\n - Generate client code.\n - Introduce a new framework or lifecycle.\n - Alter FastAPI dependency injection semantics.",
"objects": {
"bind_routes": {
"name": "bind_routes",
"kind": "function",
"path": "openapi_first.app.bind_routes",
"signature": "bind_routes(app: FastAPI, spec: dict[str, Any], routes_module: ModuleType, security_deps: dict[str, list[Any]] | None = None)",
"docstring": "Bind OpenAPI operations to FastAPI routes.\n\nArgs:\n app (FastAPI):\n The FastAPI application instance to which routes will be added.\n spec (dict[str, Any]):\n Parsed OpenAPI 3.x specification dictionary.\n routes_module (ModuleType):\n Python module containing handler functions. Each handler's name MUST\n exactly match an OpenAPI `operationId`.\n security_deps (dict[str, list[Any]] | None):\n Optional mapping of ``METHOD:/path`` → ``list[Depends(...)]``\n generated from the spec's ``securitySchemes`` and per-operation\n ``security`` fields.\n\nRaises:\n MissingOperationHandler:\n If an ``operationId`` is missing from the spec or if no corresponding\n handler function exists in the routes module.\n\nNotes:\n **Responsibilities:**\n\n - Iterates through the OpenAPI specification paths and methods.\n - Resolves each ``operationId`` to a handler function, and registers\n a corresponding ``APIRoute`` on the FastAPI application.\n - Injects FastAPI ``Depends()`` for each security requirement found\n on the operation or inherited from the top-level ``security`` field.\n\n **Guarantees:**\n\n - Route registration is deterministic and spec-driven. No route\n decorators are required or supported. Handler resolution errors\n surface at application startup."
},
"load_openapi": {
"name": "load_openapi",
"kind": "function",
"path": "openapi_first.app.load_openapi",
"signature": "load_openapi(path: str | Path)",
"docstring": "Load and validate an OpenAPI 3.x specification from disk.\n\nArgs:\n path (str | Path):\n Filesystem path to an OpenAPI specification file. Supported\n extensions: `.json`, `.yaml`, `.yml`.\n\nReturns:\n dict[str, Any]:\n Parsed and validated OpenAPI specification.\n\nRaises:\n OpenAPISpecLoadError:\n If the file does not exist, cannot be parsed, or fails OpenAPI\n schema validation.\n\nNotes:\n **Guarantees:**\n\n - The specification is parsed based on file extension and validated\n using a strict OpenAPI schema validator.\n - Any error results in an immediate exception, preventing\n application startup."
},
"make_security_dependencies": {
"name": "make_security_dependencies",
"kind": "function",
"path": "openapi_first.app.make_security_dependencies",
"signature": "make_security_dependencies(spec: dict[str, Any], security_schemes: dict[str, dict[str, Any]])",
"docstring": "Build a mapping of ``METHOD:/path`` → list of ``Depends(...)``.\n\nThe effective security for each operation is resolved by:\n\n1. Using the operation-level ``security`` field if present.\n2. Falling back to the top-level ``security`` field.\n3. An empty list means *no auth required* for that operation."
},
"parse_security_schemes": {
"name": "parse_security_schemes",
"kind": "function",
"path": "openapi_first.app.parse_security_schemes",
"signature": "parse_security_schemes(spec: dict[str, Any])",
"docstring": "Extract and resolve environment variables in security schemes."
},
"OpenAPIFirstApp": {
"name": "OpenAPIFirstApp",
"kind": "class",
"path": "openapi_first.app.OpenAPIFirstApp",
"signature": "OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)",
"docstring": "FastAPI application enforcing OpenAPI-first design.\n\nArgs:\n openapi_path (str):\n Filesystem path to the OpenAPI 3.x specification file. This\n specification is treated as the authoritative API contract.\n routes_module (ModuleType):\n Python module containing handler functions whose names correspond\n exactly to OpenAPI ``operationId`` values.\n **fastapi_kwargs (Any):\n Additional keyword arguments passed directly to\n ``fastapi.FastAPI`` (e.g., title, version, middleware, lifespan\n handlers).\n\nRaises:\n OpenAPIFirstError:\n If the OpenAPI specification is invalid, or if any declared\n ``operationId`` does not have a corresponding handler function.\n\nNotes:\n **Responsibilities:**\n\n - `OpenAPIFirstApp` subclasses `FastAPI` and replaces manual route\n registration with OpenAPI-driven binding.\n - All routes are derived from the provided OpenAPI specification,\n and each ``operationId`` is mapped to a Python function in the\n supplied routes module.\n - Auth dependencies are auto-injected from the spec's\n ``securitySchemes`` and per-operation ``security`` fields.\n\n **Guarantees:**\n\n - No route can exist without an OpenAPI declaration.\n - No OpenAPI operation can exist without a handler.\n - Swagger UI and ``/openapi.json`` always reflect the provided spec.\n - Handler functions remain framework-agnostic and testable.\n - Auth enforcement is driven entirely by the spec — no manual\n middleware or decorators required.\n\nExample:\n ```python\n from openapi_first.app import OpenAPIFirstApp\n import app.routes as routes\n\n app = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n )\n ```",
"members": {
"openapi": {
"name": "openapi",
"kind": "attribute",
"path": "openapi_first.app.OpenAPIFirstApp.openapi",
"signature": null,
"docstring": null
}
}
}
}
}
}

View File

@@ -0,0 +1,23 @@
{
"module": "openapi_first.binder",
"content": {
"path": "openapi_first.binder",
"docstring": "# Summary\n\nOpenAPI-driven route binding for FastAPI.\n\nThis module is responsible for translating an OpenAPI 3.x specification\ninto concrete FastAPI routes. It enforces a strict one-to-one mapping\nbetween OpenAPI operations and Python handler functions using `operationId`.\n\nNotes:\n **Core Responsibility:**\n\n - Read path + method definitions from an OpenAPI specification.\n - Resolve each `operationId` to a Python callable.\n - Register routes with FastAPI using `APIRoute`.\n - Fail fast when contract violations are detected.\n\n **Design Constraints:**\n\n - All routes MUST be declared in the OpenAPI specification.\n - All OpenAPI operations MUST define an `operationId`.\n - Every `operationId` MUST resolve to a handler function.\n - Handlers are plain Python callables (no decorators required).\n - No implicit route creation or inference is allowed.\n\n **Constraints:**\n\n - This module intentionally does NOT:\n - Perform request or response validation.\n - Generate Pydantic models.\n - Modify FastAPI dependency injection.\n - Interpret OpenAPI semantics beyond routing metadata.",
"objects": {
"MissingOperationHandler": {
"name": "MissingOperationHandler",
"kind": "class",
"path": "openapi_first.binder.MissingOperationHandler",
"signature": "MissingOperationHandler(*, path: str, method: str, operation_id: str | None = None)",
"docstring": "Raised when an OpenAPI operation cannot be resolved to a handler.\n\nArgs:\n path (str):\n The HTTP path declared in the OpenAPI specification.\n method (str):\n The HTTP method (as declared in the OpenAPI spec).\n operation_id (str | None):\n The operationId declared in the OpenAPI spec, if present.\n\nNotes:\n **Scenarios:**\n\n - An OpenAPI operation does not define an `operationId`.\n - An `operationId` is defined but no matching function exists in\n the provided routes module.\n\n **Guarantees:**\n\n - This represents a violation of the OpenAPI-first contract and\n indicates that the specification and implementation are out of\n sync."
},
"bind_routes": {
"name": "bind_routes",
"kind": "function",
"path": "openapi_first.binder.bind_routes",
"signature": "bind_routes(app: FastAPI, spec: dict[str, Any], routes_module: ModuleType, security_deps: dict[str, list[Any]] | None = None) -> None",
"docstring": "Bind OpenAPI operations to FastAPI routes.\n\nArgs:\n app (FastAPI):\n The FastAPI application instance to which routes will be added.\n spec (dict[str, Any]):\n Parsed OpenAPI 3.x specification dictionary.\n routes_module (ModuleType):\n Python module containing handler functions. Each handler's name MUST\n exactly match an OpenAPI `operationId`.\n security_deps (dict[str, list[Any]] | None):\n Optional mapping of ``METHOD:/path`` → ``list[Depends(...)]``\n generated from the spec's ``securitySchemes`` and per-operation\n ``security`` fields.\n\nRaises:\n MissingOperationHandler:\n If an ``operationId`` is missing from the spec or if no corresponding\n handler function exists in the routes module.\n\nNotes:\n **Responsibilities:**\n\n - Iterates through the OpenAPI specification paths and methods.\n - Resolves each ``operationId`` to a handler function, and registers\n a corresponding ``APIRoute`` on the FastAPI application.\n - Injects FastAPI ``Depends()`` for each security requirement found\n on the operation or inherited from the top-level ``security`` field.\n\n **Guarantees:**\n\n - Route registration is deterministic and spec-driven. No route\n decorators are required or supported. Handler resolution errors\n surface at application startup."
}
}
}
}

View File

@@ -0,0 +1,37 @@
{
"module": "openapi_first.cli",
"content": {
"path": "openapi_first.cli",
"docstring": "# Summary\n\nCommand-line interface for FastAPI OpenAPI-first scaffolding utilities.\n\nThis CLI bootstraps OpenAPI-first FastAPI applications from versioned,\nbundled templates packaged with the library.",
"objects": {
"DEFAULT_TEMPLATE": {
"name": "DEFAULT_TEMPLATE",
"kind": "attribute",
"path": "openapi_first.cli.DEFAULT_TEMPLATE",
"signature": null,
"docstring": null
},
"available_templates": {
"name": "available_templates",
"kind": "function",
"path": "openapi_first.cli.available_templates",
"signature": "available_templates() -> list[str]",
"docstring": "Return a list of available application templates.\n\nReturns:\n list[str]:\n Sorted list of template names found in the internal templates directory."
},
"copy_template": {
"name": "copy_template",
"kind": "function",
"path": "openapi_first.cli.copy_template",
"signature": "copy_template(template: str, target_dir: Path) -> None",
"docstring": "Copy a bundled OpenAPI-first application template into a directory.\n\nArgs:\n template (str):\n Name of the template to copy.\n target_dir (Path):\n Filesystem path where the template should be copied.\n\nRaises:\n FileNotFoundError:\n If the requested template does not exist."
},
"main": {
"name": "main",
"kind": "function",
"path": "openapi_first.cli.main",
"signature": "main() -> None",
"docstring": null
}
}
}
}

View File

@@ -0,0 +1,60 @@
{
"module": "openapi_first.client",
"content": {
"path": "openapi_first.client",
"docstring": "# Summary\n\nOpenAPI-first HTTP client for contract-driven services.\n\nThis module provides `OpenAPIClient`, a thin, strict HTTP client that\nderives all callable operations directly from an OpenAPI 3.x specification.\n\nIt is the client counterpart to `OpenAPIFirstApp`.\n\nNotes:\n **Core Principles:**\n\n - The OpenAPI specification is the single source of truth\n - Each operationId becomes a callable Python method\n - No implicit schema mutation or inference\n - No code generation step\n - Minimal abstraction over httpx\n\n **Responsibilities:**\n\n - Parses an OpenAPI 3.x specification\n - Dynamically creates one callable per operationId\n - Enforces presence of servers, paths, and operationId\n - Formats path parameters safely\n - Handles JSON request bodies explicitly\n - Returns raw `httpx.Response` objects\n\n **Constraints:**\n\n - This module intentionally does NOT: Generate client code, validate request/response schemas, deserialize responses, retry requests, implement authentication helpers, or assume non-2xx responses are failures.",
"objects": {
"OpenAPIFirstError": {
"name": "OpenAPIFirstError",
"kind": "class",
"path": "openapi_first.client.OpenAPIFirstError",
"signature": null,
"docstring": "Base exception for all OpenAPI-first enforcement errors.\n\nNotes:\n **Responsibilities:**\n\n - This exception exists to allow callers, test suites, and CI\n pipelines to catch and distinguish OpenAPI contract violations\n from unrelated runtime errors.\n - All exceptions raised by the OpenAPI-first core should inherit\n from this type."
},
"OpenAPIClientError": {
"name": "OpenAPIClientError",
"kind": "class",
"path": "openapi_first.client.OpenAPIClientError",
"signature": null,
"docstring": "Raised when an OpenAPI client operation fails."
},
"OpenAPIClient": {
"name": "OpenAPIClient",
"kind": "class",
"path": "openapi_first.client.OpenAPIClient",
"signature": "OpenAPIClient(spec: dict[str, Any], base_url: str | None = None, client: httpx.Client | None = None)",
"docstring": "OpenAPI-first HTTP client (`httpx`-based).\n\nArgs:\n spec (dict[str, Any]):\n Parsed OpenAPI 3.x specification.\n base_url (str | None):\n Base URL of the target service. If omitted, the first entry in the\n OpenAPI `servers` list is used.\n client (httpx.Client | None):\n Optional preconfigured httpx client instance.\n\nRaises:\n OpenAPIClientError:\n If no servers are defined, spec has no paths, operationIds are\n missing/duplicate, or required parameters are missing.\n\nNotes:\n **Responsibilities:**\n\n - This client derives all callable methods directly from an\n OpenAPI 3.x specification. Each `operationId` becomes a method\n on the client instance.\n\n **Guarantees:**\n\n - One callable per `operationId`.\n - Explicit parameters (path, query, headers, body).\n - No implicit schema inference or mutation.\n - Returns raw `httpx.Response` objects.\n - No response validation or deserialization.\n\nExample:\n ```python\n from openapi_first import loader, client\n\n spec = loader.load_openapi(\"openapi.yaml\")\n\n api = client.OpenAPIClient(\n spec=spec,\n base_url=\"http://localhost:8000\",\n )\n\n # Call operationId: getUser\n response = api.getUser(\n path_params={\"user_id\": 123}\n )\n\n print(response.status_code)\n print(response.json())\n ```",
"members": {
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.client.OpenAPIClient.spec",
"signature": null,
"docstring": null
},
"base_url": {
"name": "base_url",
"kind": "attribute",
"path": "openapi_first.client.OpenAPIClient.base_url",
"signature": null,
"docstring": null
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.client.OpenAPIClient.client",
"signature": null,
"docstring": null
},
"operations": {
"name": "operations",
"kind": "function",
"path": "openapi_first.client.OpenAPIClient.operations",
"signature": "operations() -> dict[str, Callable[..., httpx.Response]]",
"docstring": null
}
}
}
}
}
}

View File

@@ -0,0 +1,23 @@
{
"module": "openapi_first.codegen",
"content": {
"path": "openapi_first.codegen",
"docstring": "# Summary\n\nCore logic for generating Python source code from OpenAPI specifications.\n\nThis module provides reusable utilities for code generation, specifically\ngenerating Pydantic models and route handler stubs from OpenAPI 3.x schema\ndefinitions.",
"objects": {
"generate_routes": {
"name": "generate_routes",
"kind": "function",
"path": "openapi_first.codegen.generate_routes",
"signature": "generate_routes(spec_path: Path, output_dir: Path, *, use_models: bool = False, models_module: str = 'models', inject_request: bool = False, package: bool = False, template_style: bool = False)",
"docstring": "Generate route handler stubs from an OpenAPI specification.\n\nCreates one route module per resource in *output_dir*. Resources are\nderived from the first path segment (e.g. ``/pets`` and ``/pets/{id}``\nboth group under ``pets``) and sanitized to valid module identifiers.\n\nArgs:\n spec_path (Path):\n Path to the OpenAPI specification file (YAML or JSON).\n output_dir (Path):\n Directory where the generated route files are written.\n Created automatically if it does not exist.\n use_models (bool, optional):\n If ``True``, import Pydantic models from *models_module*\n for request-body schemas referenced via ``$ref``.\n models_module (str, optional):\n Dotted Python module path from which to import models\n (e.g. ``\"models\"``, ``\"app.models\"``).\n inject_request (bool, optional):\n If ``True``, prepend ``request: Request`` to every handler so the\n stub can later resolve services from ``request.app.state``.\n package (bool, optional):\n If ``True``, emit ``<resource>/routes.py`` packages (each with an\n ``__init__.py``) instead of flat ``<resource>.py`` modules.\n template_style (bool, optional):\n If ``True``, emit ``async def`` handlers with a JSON body parameter\n named ``body`` (the standards-template convention) plus a\n service-resolution hint comment, instead of sync ``def`` handlers\n taking ``payload``.\n\nReturns:\n list[Path]:\n Absolute paths of every generated route file.\n\nRaises:\n OpenAPISpecLoadError:\n If the spec cannot be loaded or validated.\n ValueError:\n If any operation is missing ``operationId``."
},
"generate_models": {
"name": "generate_models",
"kind": "function",
"path": "openapi_first.codegen.generate_models",
"signature": "generate_models(spec_path: Path, output_path: Path, pydantic_version: int = 2) -> None",
"docstring": "Generate Pydantic models from an OpenAPI specification.\n\nArgs:\n spec_path (Path):\n Path to the OpenAPI specification file (YAML or JSON).\n output_path (Path):\n Path where the generated Python code should be written.\n pydantic_version (int, optional):\n The Pydantic version to target (1 or 2). Defaults to 2.\n\nNotes:\n **Reusability:**\n This function is designed to be used by the CLI and can be\n exposed as an MCP tool without modification."
}
}
}
}

View File

@@ -0,0 +1,23 @@
{
"module": "openapi_first.codegen_routes",
"content": {
"path": "openapi_first.codegen_routes",
"docstring": "# Summary\n\nRoute handler code generation from OpenAPI specifications.\n\nThis module generates Python route handler stubs from an OpenAPI 3.x\nspecification. Each resource (derived from the first path segment)\ngets its own file under the output directory. Every OpenAPI operation\nmust define an ``operationId``, which becomes the handler function name.\n\nNotes:\n **Design constraints:**\n\n - ``operationId`` is required on every operation (matching\n ``binder.bind_routes``).\n - Handlers are stubs raising ``NotImplementedError``.\n - Sub-resources (e.g. ``/pets/{id}/photo``) are grouped with their\n parent resource (``pets``).\n - Parameter types and defaults are inferred from the spec.\n - ``response: Response`` is injected for non-200 success codes.\n - Resource names are sanitized to valid Python module identifiers,\n so a path such as ``/fetch-requests`` yields ``fetch_requests.py``.\n - Passing ``inject_request=True`` prepends ``request: Request`` to\n every handler (the composition-root / DI convention).\n - ``multipart/form-data`` and\n ``application/x-www-form-urlencoded`` request bodies expand to one\n parameter per schema property (``UploadFile`` / ``File`` / ``Form``)\n instead of an opaque ``payload: dict``.\n - Passing ``package=True`` writes ``<resource>/routes.py`` (with\n ``__init__.py`` sidecars) instead of a flat ``<resource>.py``.\n - Passing ``template_style=True`` emits ``async def`` handlers whose\n JSON body parameter is named ``body`` (matching the standards\n template) and adds a service-resolution hint comment.",
"objects": {
"load_openapi": {
"name": "load_openapi",
"kind": "function",
"path": "openapi_first.codegen_routes.load_openapi",
"signature": "load_openapi(path: str | Path)",
"docstring": "Load and validate an OpenAPI 3.x specification from disk.\n\nArgs:\n path (str | Path):\n Filesystem path to an OpenAPI specification file. Supported\n extensions: `.json`, `.yaml`, `.yml`.\n\nReturns:\n dict[str, Any]:\n Parsed and validated OpenAPI specification.\n\nRaises:\n OpenAPISpecLoadError:\n If the file does not exist, cannot be parsed, or fails OpenAPI\n schema validation.\n\nNotes:\n **Guarantees:**\n\n - The specification is parsed based on file extension and validated\n using a strict OpenAPI schema validator.\n - Any error results in an immediate exception, preventing\n application startup."
},
"generate_routes": {
"name": "generate_routes",
"kind": "function",
"path": "openapi_first.codegen_routes.generate_routes",
"signature": "generate_routes(spec_path: Path, output_dir: Path, *, use_models: bool = False, models_module: str = 'models', inject_request: bool = False, package: bool = False, template_style: bool = False) -> list[Path]",
"docstring": "Generate route handler stubs from an OpenAPI specification.\n\nCreates one route module per resource in *output_dir*. Resources are\nderived from the first path segment (e.g. ``/pets`` and ``/pets/{id}``\nboth group under ``pets``) and sanitized to valid module identifiers.\n\nArgs:\n spec_path (Path):\n Path to the OpenAPI specification file (YAML or JSON).\n output_dir (Path):\n Directory where the generated route files are written.\n Created automatically if it does not exist.\n use_models (bool, optional):\n If ``True``, import Pydantic models from *models_module*\n for request-body schemas referenced via ``$ref``.\n models_module (str, optional):\n Dotted Python module path from which to import models\n (e.g. ``\"models\"``, ``\"app.models\"``).\n inject_request (bool, optional):\n If ``True``, prepend ``request: Request`` to every handler so the\n stub can later resolve services from ``request.app.state``.\n package (bool, optional):\n If ``True``, emit ``<resource>/routes.py`` packages (each with an\n ``__init__.py``) instead of flat ``<resource>.py`` modules.\n template_style (bool, optional):\n If ``True``, emit ``async def`` handlers with a JSON body parameter\n named ``body`` (the standards-template convention) plus a\n service-resolution hint comment, instead of sync ``def`` handlers\n taking ``payload``.\n\nReturns:\n list[Path]:\n Absolute paths of every generated route file.\n\nRaises:\n OpenAPISpecLoadError:\n If the spec cannot be loaded or validated.\n ValueError:\n If any operation is missing ``operationId``."
}
}
}
}

View File

@@ -0,0 +1,23 @@
{
"module": "openapi_first.errors",
"content": {
"path": "openapi_first.errors",
"docstring": "# Summary\n\nExceptions for OpenAPI-first FastAPI applications.\n\nThis module defines a small hierarchy of explicit, intention-revealing\nexceptions used to signal contract violations between an OpenAPI\nspecification and its Python implementation.\n\nNotes:\n **Design Principles:**\n\n - Errors represent programmer mistakes, not runtime conditions.\n - All errors are raised during application startup.\n - Messages are actionable and suitable for CI/CD output.\n - Exceptions are explicit rather than reused from generic built-ins.\n\n These errors should normally cause immediate application failure.",
"objects": {
"OpenAPIFirstError": {
"name": "OpenAPIFirstError",
"kind": "class",
"path": "openapi_first.errors.OpenAPIFirstError",
"signature": null,
"docstring": "Base exception for all OpenAPI-first enforcement errors.\n\nNotes:\n **Responsibilities:**\n\n - This exception exists to allow callers, test suites, and CI\n pipelines to catch and distinguish OpenAPI contract violations\n from unrelated runtime errors.\n - All exceptions raised by the OpenAPI-first core should inherit\n from this type."
},
"MissingOperationHandler": {
"name": "MissingOperationHandler",
"kind": "class",
"path": "openapi_first.errors.MissingOperationHandler",
"signature": "MissingOperationHandler(*, path: str, method: str, operation_id: str | None = None)",
"docstring": "Raised when an OpenAPI operation cannot be resolved to a handler.\n\nArgs:\n path (str):\n The HTTP path declared in the OpenAPI specification.\n method (str):\n The HTTP method (as declared in the OpenAPI spec).\n operation_id (str | None):\n The operationId declared in the OpenAPI spec, if present.\n\nNotes:\n **Scenarios:**\n\n - An OpenAPI operation does not define an `operationId`.\n - An `operationId` is defined but no matching function exists in\n the provided routes module.\n\n **Guarantees:**\n\n - This represents a violation of the OpenAPI-first contract and\n indicates that the specification and implementation are out of\n sync."
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
{
"module": "openapi_first.loader",
"content": {
"path": "openapi_first.loader",
"docstring": "# Summary\n\nOpenAPI specification loading and validation utilities.\n\nThis module is responsible for loading an OpenAPI 3.x specification\nfrom disk and validating it before it is used by the application.\n\nIt enforces the principle that an invalid or malformed OpenAPI document\nmust never reach the routing or runtime layers.\n\nNotes:\n **Design Principles:**\n\n - OpenAPI is treated as an authoritative contract.\n - Invalid specifications fail fast at application startup.\n - Supported formats are JSON and YAML.\n - Validation errors are surfaced clearly and early.\n\n **Constraints:**\n\n - This module intentionally does NOT:\n - Modify the OpenAPI document.\n - Infer missing fields.\n - Generate models or code.\n - Perform request/response validation at runtime.",
"objects": {
"OpenAPIFirstError": {
"name": "OpenAPIFirstError",
"kind": "class",
"path": "openapi_first.loader.OpenAPIFirstError",
"signature": null,
"docstring": "Base exception for all OpenAPI-first enforcement errors.\n\nNotes:\n **Responsibilities:**\n\n - This exception exists to allow callers, test suites, and CI\n pipelines to catch and distinguish OpenAPI contract violations\n from unrelated runtime errors.\n - All exceptions raised by the OpenAPI-first core should inherit\n from this type."
},
"OpenAPISpecLoadError": {
"name": "OpenAPISpecLoadError",
"kind": "class",
"path": "openapi_first.loader.OpenAPISpecLoadError",
"signature": null,
"docstring": "Raised when an OpenAPI specification cannot be loaded or validated.\n\nNotes:\n **Guarantees:**\n\n - This error indicates that the OpenAPI document is unreadable,\n malformed, or violates the OpenAPI 3.x specification."
},
"load_openapi": {
"name": "load_openapi",
"kind": "function",
"path": "openapi_first.loader.load_openapi",
"signature": "load_openapi(path: str | Path) -> dict[str, Any]",
"docstring": "Load and validate an OpenAPI 3.x specification from disk.\n\nArgs:\n path (str | Path):\n Filesystem path to an OpenAPI specification file. Supported\n extensions: `.json`, `.yaml`, `.yml`.\n\nReturns:\n dict[str, Any]:\n Parsed and validated OpenAPI specification.\n\nRaises:\n OpenAPISpecLoadError:\n If the file does not exist, cannot be parsed, or fails OpenAPI\n schema validation.\n\nNotes:\n **Guarantees:**\n\n - The specification is parsed based on file extension and validated\n using a strict OpenAPI schema validator.\n - Any error results in an immediate exception, preventing\n application startup."
}
}
}
}

View File

@@ -0,0 +1,23 @@
{
"module": "openapi_first.security",
"content": {
"path": "openapi_first.security",
"docstring": "# Summary\n\nOpenAPI security scheme parsing and auto-generated auth dependencies.\n\nThis module reads `securitySchemes` and per-operation `security` from an\nOpenAPI spec, resolves `{ENV_VAR}` placeholders in `x-` extension fields,\nand generates FastAPI dependencies for token validation (e.g., Bearer JWT\nintrospection).",
"objects": {
"parse_security_schemes": {
"name": "parse_security_schemes",
"kind": "function",
"path": "openapi_first.security.parse_security_schemes",
"signature": "parse_security_schemes(spec: dict[str, Any]) -> dict[str, dict[str, Any]]",
"docstring": "Extract and resolve environment variables in security schemes."
},
"make_security_dependencies": {
"name": "make_security_dependencies",
"kind": "function",
"path": "openapi_first.security.make_security_dependencies",
"signature": "make_security_dependencies(spec: dict[str, Any], security_schemes: dict[str, dict[str, Any]]) -> dict[str, list[Any]]",
"docstring": "Build a mapping of ``METHOD:/path`` → list of ``Depends(...)``.\n\nThe effective security for each operation is resolved by:\n\n1. Using the operation-level ``security`` field if present.\n2. Falling back to the top-level ``security`` field.\n3. An empty list means *no auth required* for that operation."
}
}
}
}

View File

@@ -0,0 +1,44 @@
{
"module": "openapi_first.templates.crud_app.data",
"content": {
"path": "openapi_first.templates.crud_app.data",
"docstring": "In-memory mock data store for CRUD example.\n\nThis module intentionally avoids persistence and concurrency guarantees.\nIt is suitable for demos, tests, and scaffolding only.\n\nIt intentionally avoids\n- persistence\n- concurrency guarantees\n- validation\n- error handling\n\nThe implementation is suitable for:\n- demonstrations\n- tests\n- scaffolding and example services\n\nIt is explicitly NOT suitable for production use.\n\nThis module is not part of the ``openapi_first`` library API surface.",
"objects": {
"list_items": {
"name": "list_items",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.list_items",
"signature": "list_items() -> list[dict]",
"docstring": "Return all items in the data store.\n\nThis function performs no filtering, pagination, or sorting.\nThe returned collection reflects the current in-memory state.\n\nReturns\n-------\nlist[dict]\n A list of item representations."
},
"get_item": {
"name": "get_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.get_item",
"signature": "get_item(item_id: int) -> dict",
"docstring": "Retrieve a single item by ID.\n\nThis function assumes the item exists and will raise ``KeyError``\nif the ID is not present in the store.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to retrieve.\n\nReturns\n-------\ndict\n The stored item representation."
},
"create_item": {
"name": "create_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.create_item",
"signature": "create_item(payload: dict) -> dict",
"docstring": "Create a new item in the data store.\n\nA new integer ID is assigned automatically. No validation is\nperformed on the provided payload.\n\nParameters\n----------\npayload : dict\n Item attributes excluding the ``id`` field.\n\nReturns\n-------\ndict\n The newly created item, including its assigned ID."
},
"update_item": {
"name": "update_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.update_item",
"signature": "update_item(item_id: int, payload: dict) -> dict",
"docstring": "Replace an existing item in the data store.\n\nThis function overwrites the existing item entirely and does not\nperform partial updates or validation. If the item does not exist,\nit will be created implicitly.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to update.\npayload : dict\n Item attributes excluding the ``id`` field.\n\nReturns\n-------\ndict\n The updated item representation."
},
"delete_item": {
"name": "delete_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.delete_item",
"signature": "delete_item(item_id: int)",
"docstring": "Remove an item from the data store.\n\nThis function assumes the item exists and will raise ``KeyError``\nif the ID is not present.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to delete."
}
}
}
}

View File

@@ -0,0 +1,231 @@
{
"module": "openapi_first.templates.crud_app",
"content": {
"path": "openapi_first.templates.crud_app",
"docstring": "OpenAPI-first CRUD application template.\n\nThis package contains a complete, minimal example of an OpenAPI-first\nCRUD service built using the ``openapi_first`` library.\n\nThe application is assembled exclusively from:\n- an OpenAPI specification (``openapi.yaml``)\n- a handler namespace implementing CRUD operations (``routes``)\n- an in-memory mock data store (``data``)\n\nAll HTTP routes, methods, schemas, and operation bindings are defined\nin the OpenAPI specification and enforced at application startup.\nNo decorator-driven routing or implicit framework behavior is used.\n\nThis template demonstrates:\n- operationId-driven server-side route binding\n- explicit HTTP status code control in handlers\n- operationId-driven client usage against the same OpenAPI contract\n- end-to-end validation using in-memory data and tests\n\n----------------------------------------------------------------------\nScaffolding via CLI\n----------------------------------------------------------------------\n\nCreate a new CRUD example service using the bundled template:\n\n openapi-first scaffold crud_app\n\nCreate the service in a custom directory:\n\n openapi-first scaffold crud_app my-crud-service\n\nList all available application templates:\n\n openapi-first scaffold --list\n\nThe CLI copies template files verbatim into the target directory.\nNo code is generated or modified beyond the copied scaffold.\n\n----------------------------------------------------------------------\nClient Usage Example\n----------------------------------------------------------------------\n\nThe same OpenAPI specification used by the server can be used to\nconstruct a strict, operationId-driven HTTP client.\n\nExample client calls for CRUD operations:\n\n from openapi_first.loader import load_openapi\n from openapi_first.client import OpenAPIClient\n\n spec = load_openapi(\"openapi.yaml\")\n client = OpenAPIClient(spec)\n\n # List items\n response = client.list_items()\n\n # Get item by ID\n response = client.get_item(\n path_params={\"item_id\": 1}\n )\n\n # Create item\n response = client.create_item(\n body={\"name\": \"Orange\", \"price\": 0.8}\n )\n\n # Update item\n response = client.update_item(\n path_params={\"item_id\": 1},\n body={\"name\": \"Green Apple\", \"price\": 0.6},\n )\n\n # Delete item\n response = client.delete_item(\n path_params={\"item_id\": 1}\n )\n\nClient guarantees:\n- One callable per OpenAPI ``operationId``\n- No hardcoded URLs or HTTP methods in user code\n- Path and request parameters must match the OpenAPI specification\n- Invalid or incomplete OpenAPI specs fail at client construction time\n\n----------------------------------------------------------------------\nNon-Goals\n----------------------------------------------------------------------\n\nThis template is intentionally minimal and is NOT:\n- production-ready\n- persistent or concurrency-safe\n- a reference architecture for data storage\n\nIt exists solely as a copyable example for learning, testing, and\nbootstrapping OpenAPI-first services.\n\nThis package is not part of the ``openapi_first`` library API surface.",
"objects": {
"data": {
"name": "data",
"kind": "module",
"path": "openapi_first.templates.crud_app.data",
"signature": null,
"docstring": "In-memory mock data store for CRUD example.\n\nThis module intentionally avoids persistence and concurrency guarantees.\nIt is suitable for demos, tests, and scaffolding only.\n\nIt intentionally avoids\n- persistence\n- concurrency guarantees\n- validation\n- error handling\n\nThe implementation is suitable for:\n- demonstrations\n- tests\n- scaffolding and example services\n\nIt is explicitly NOT suitable for production use.\n\nThis module is not part of the ``openapi_first`` library API surface.",
"members": {
"list_items": {
"name": "list_items",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.list_items",
"signature": "list_items() -> list[dict]",
"docstring": "Return all items in the data store.\n\nThis function performs no filtering, pagination, or sorting.\nThe returned collection reflects the current in-memory state.\n\nReturns\n-------\nlist[dict]\n A list of item representations."
},
"get_item": {
"name": "get_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.get_item",
"signature": "get_item(item_id: int) -> dict",
"docstring": "Retrieve a single item by ID.\n\nThis function assumes the item exists and will raise ``KeyError``\nif the ID is not present in the store.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to retrieve.\n\nReturns\n-------\ndict\n The stored item representation."
},
"create_item": {
"name": "create_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.create_item",
"signature": "create_item(payload: dict) -> dict",
"docstring": "Create a new item in the data store.\n\nA new integer ID is assigned automatically. No validation is\nperformed on the provided payload.\n\nParameters\n----------\npayload : dict\n Item attributes excluding the ``id`` field.\n\nReturns\n-------\ndict\n The newly created item, including its assigned ID."
},
"update_item": {
"name": "update_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.update_item",
"signature": "update_item(item_id: int, payload: dict) -> dict",
"docstring": "Replace an existing item in the data store.\n\nThis function overwrites the existing item entirely and does not\nperform partial updates or validation. If the item does not exist,\nit will be created implicitly.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to update.\npayload : dict\n Item attributes excluding the ``id`` field.\n\nReturns\n-------\ndict\n The updated item representation."
},
"delete_item": {
"name": "delete_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.data.delete_item",
"signature": "delete_item(item_id: int)",
"docstring": "Remove an item from the data store.\n\nThis function assumes the item exists and will raise ``KeyError``\nif the ID is not present.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to delete."
}
}
},
"main": {
"name": "main",
"kind": "module",
"path": "openapi_first.templates.crud_app.main",
"signature": null,
"docstring": "Application entry point for an OpenAPI-first CRUD example service.\n\nThis module constructs a FastAPI application exclusively from an\nOpenAPI specification and a handler namespace, without using\ndecorator-driven routing.\n\nAll HTTP routes, methods, request/response schemas, and operation\nbindings are defined in the OpenAPI document referenced by\n``openapi_path``. Python callables defined in the ``routes`` module are\nbound to OpenAPI operations strictly via ``operationId``.\n\nThis module contains no routing logic, persistence concerns, or\nframework configuration beyond application assembly.\n\nDesign guarantees:\n- OpenAPI is the single source of truth\n- No undocumented routes can exist\n- Every OpenAPI operationId must resolve to exactly one handler\n- All contract violations fail at application startup\n\nThis file is intended to be used as the ASGI entry point.\n\nExample:\n uvicorn main:app",
"members": {
"OpenAPIFirstApp": {
"name": "OpenAPIFirstApp",
"kind": "class",
"path": "openapi_first.templates.crud_app.main.OpenAPIFirstApp",
"signature": "OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)",
"docstring": "FastAPI application enforcing OpenAPI-first design.\n\nArgs:\n openapi_path (str):\n Filesystem path to the OpenAPI 3.x specification file. This\n specification is treated as the authoritative API contract.\n routes_module (ModuleType):\n Python module containing handler functions whose names correspond\n exactly to OpenAPI ``operationId`` values.\n **fastapi_kwargs (Any):\n Additional keyword arguments passed directly to\n ``fastapi.FastAPI`` (e.g., title, version, middleware, lifespan\n handlers).\n\nRaises:\n OpenAPIFirstError:\n If the OpenAPI specification is invalid, or if any declared\n ``operationId`` does not have a corresponding handler function.\n\nNotes:\n **Responsibilities:**\n\n - `OpenAPIFirstApp` subclasses `FastAPI` and replaces manual route\n registration with OpenAPI-driven binding.\n - All routes are derived from the provided OpenAPI specification,\n and each ``operationId`` is mapped to a Python function in the\n supplied routes module.\n - Auth dependencies are auto-injected from the spec's\n ``securitySchemes`` and per-operation ``security`` fields.\n\n **Guarantees:**\n\n - No route can exist without an OpenAPI declaration.\n - No OpenAPI operation can exist without a handler.\n - Swagger UI and ``/openapi.json`` always reflect the provided spec.\n - Handler functions remain framework-agnostic and testable.\n - Auth enforcement is driven entirely by the spec — no manual\n middleware or decorators required.\n\nExample:\n ```python\n from openapi_first.app import OpenAPIFirstApp\n import app.routes as routes\n\n app = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n )\n ```",
"members": {
"openapi": {
"name": "openapi",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.main.OpenAPIFirstApp.openapi",
"signature": null,
"docstring": null
}
}
},
"app": {
"name": "app",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.main.app",
"signature": null,
"docstring": null
}
}
},
"routes": {
"name": "routes",
"kind": "module",
"path": "openapi_first.templates.crud_app.routes",
"signature": null,
"docstring": "CRUD route handlers bound via OpenAPI operationId.\n\nThese handlers explicitly control HTTP status codes to ensure\nruntime behavior matches the OpenAPI contract.\n\nThis module defines OpenAPI-bound operation handlers for a simple CRUD\nservice. Functions in this module are bound to HTTP routes exclusively\nvia OpenAPI ``operationId`` values.\n\nHandlers explicitly control HTTP response status codes to ensure runtime\nbehavior matches the OpenAPI contract. Error conditions are translated\ninto explicit HTTP responses rather than relying on implicit framework\nbehavior.\n\nNo routing decorators or path definitions appear in this module. All\nrouting, HTTP methods, and schemas are defined in the OpenAPI\nspecification.",
"members": {
"list_items": {
"name": "list_items",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.list_items",
"signature": "list_items() -> list[dict]",
"docstring": "List all items.\n\nImplements the OpenAPI operation identified by\n``operationId: list_items``.\n\nReturns\n-------\nlist[dict]\n A list of item representations."
},
"get_item": {
"name": "get_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.get_item",
"signature": "get_item(item_id: int) -> dict",
"docstring": "Retrieve a single item by ID.\n\nImplements the OpenAPI operation identified by\n``operationId: get_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to retrieve.\n\nReturns\n-------\ndict\n The requested item.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
},
"create_item": {
"name": "create_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.create_item",
"signature": "create_item(payload: dict, response: Response) -> dict",
"docstring": "Create a new item.\n\nImplements the OpenAPI operation identified by\n``operationId: create_item``.\n\nParameters\n----------\npayload : dict\n Item attributes excluding the ``id`` field.\nresponse : Response\n Response object used to set the HTTP status code.\n\nReturns\n-------\ndict\n The newly created item."
},
"update_item": {
"name": "update_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.update_item",
"signature": "update_item(item_id: int, payload: dict) -> dict",
"docstring": "Update an existing item.\n\nImplements the OpenAPI operation identified by\n``operationId: update_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to update.\npayload : dict\n Item attributes excluding the ``id`` field.\n\nReturns\n-------\ndict\n The updated item.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
},
"delete_item": {
"name": "delete_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.delete_item",
"signature": "delete_item(item_id: int, response: Response) -> None",
"docstring": "Delete an existing item.\n\nImplements the OpenAPI operation identified by\n``operationId: delete_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to delete.\nresponse : Response\n Response object used to set the HTTP status code.\n\nReturns\n-------\nNone\n No content.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
}
}
},
"test_crud_app": {
"name": "test_crud_app",
"kind": "module",
"path": "openapi_first.templates.crud_app.test_crud_app",
"signature": null,
"docstring": "End-to-end tests for the OpenAPI-first CRUD example app.\n\nThese tests validate that all CRUD operations behave correctly\nagainst the in-memory mock data store.\n- OpenAPI specification loading\n- OperationId-driven route binding on the server\n- OperationId-driven client invocation\n- Correct HTTP status codes and response payloads\n\nThe tests exercise all CRUD operations against an in-memory mock data\nstore and assume deterministic behavior within a single process.\n\nThe tests assume:\n- OpenAPI-first route binding\n- In-memory storage (no persistence guarantees)\n- Deterministic behavior in a single process\n- One-to-one correspondence between OpenAPI operationId values and\n server/client callables",
"members": {
"load_openapi": {
"name": "load_openapi",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.load_openapi",
"signature": "load_openapi(path: str | Path)",
"docstring": "Load and validate an OpenAPI 3.x specification from disk.\n\nArgs:\n path (str | Path):\n Filesystem path to an OpenAPI specification file. Supported\n extensions: `.json`, `.yaml`, `.yml`.\n\nReturns:\n dict[str, Any]:\n Parsed and validated OpenAPI specification.\n\nRaises:\n OpenAPISpecLoadError:\n If the file does not exist, cannot be parsed, or fails OpenAPI\n schema validation.\n\nNotes:\n **Guarantees:**\n\n - The specification is parsed based on file extension and validated\n using a strict OpenAPI schema validator.\n - Any error results in an immediate exception, preventing\n application startup."
},
"OpenAPIClient": {
"name": "OpenAPIClient",
"kind": "class",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient",
"signature": "OpenAPIClient(spec: dict[str, Any], base_url: str | None = None, client: httpx.Client | None = None)",
"docstring": "OpenAPI-first HTTP client (`httpx`-based).\n\nArgs:\n spec (dict[str, Any]):\n Parsed OpenAPI 3.x specification.\n base_url (str | None):\n Base URL of the target service. If omitted, the first entry in the\n OpenAPI `servers` list is used.\n client (httpx.Client | None):\n Optional preconfigured httpx client instance.\n\nRaises:\n OpenAPIClientError:\n If no servers are defined, spec has no paths, operationIds are\n missing/duplicate, or required parameters are missing.\n\nNotes:\n **Responsibilities:**\n\n - This client derives all callable methods directly from an\n OpenAPI 3.x specification. Each `operationId` becomes a method\n on the client instance.\n\n **Guarantees:**\n\n - One callable per `operationId`.\n - Explicit parameters (path, query, headers, body).\n - No implicit schema inference or mutation.\n - Returns raw `httpx.Response` objects.\n - No response validation or deserialization.\n\nExample:\n ```python\n from openapi_first import loader, client\n\n spec = loader.load_openapi(\"openapi.yaml\")\n\n api = client.OpenAPIClient(\n spec=spec,\n base_url=\"http://localhost:8000\",\n )\n\n # Call operationId: getUser\n response = api.getUser(\n path_params={\"user_id\": 123}\n )\n\n print(response.status_code)\n print(response.json())\n ```",
"members": {
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.spec",
"signature": null,
"docstring": null
},
"base_url": {
"name": "base_url",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.base_url",
"signature": null,
"docstring": null
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.client",
"signature": null,
"docstring": null
},
"operations": {
"name": "operations",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.operations",
"signature": "operations()",
"docstring": null
}
}
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.client",
"signature": null,
"docstring": null
},
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.spec",
"signature": null,
"docstring": null
},
"test_list_items_initial": {
"name": "test_list_items_initial",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_list_items_initial",
"signature": "test_list_items_initial()",
"docstring": "Initial items should be present."
},
"test_get_item": {
"name": "test_get_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_get_item",
"signature": "test_get_item()",
"docstring": "Existing item should be retrievable by ID."
},
"test_create_item": {
"name": "test_create_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_create_item",
"signature": "test_create_item()",
"docstring": "Creating a new item should return the created entity."
},
"test_update_item": {
"name": "test_update_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_update_item",
"signature": "test_update_item()",
"docstring": "Updating an item should replace its values."
},
"test_delete_item": {
"name": "test_delete_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_delete_item",
"signature": "test_delete_item()",
"docstring": "Deleting an item should remove it from the store."
}
}
}
}
}
}

View File

@@ -0,0 +1,32 @@
{
"module": "openapi_first.templates.crud_app.main",
"content": {
"path": "openapi_first.templates.crud_app.main",
"docstring": "Application entry point for an OpenAPI-first CRUD example service.\n\nThis module constructs a FastAPI application exclusively from an\nOpenAPI specification and a handler namespace, without using\ndecorator-driven routing.\n\nAll HTTP routes, methods, request/response schemas, and operation\nbindings are defined in the OpenAPI document referenced by\n``openapi_path``. Python callables defined in the ``routes`` module are\nbound to OpenAPI operations strictly via ``operationId``.\n\nThis module contains no routing logic, persistence concerns, or\nframework configuration beyond application assembly.\n\nDesign guarantees:\n- OpenAPI is the single source of truth\n- No undocumented routes can exist\n- Every OpenAPI operationId must resolve to exactly one handler\n- All contract violations fail at application startup\n\nThis file is intended to be used as the ASGI entry point.\n\nExample:\n uvicorn main:app",
"objects": {
"OpenAPIFirstApp": {
"name": "OpenAPIFirstApp",
"kind": "class",
"path": "openapi_first.templates.crud_app.main.OpenAPIFirstApp",
"signature": "OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)",
"docstring": "FastAPI application enforcing OpenAPI-first design.\n\nArgs:\n openapi_path (str):\n Filesystem path to the OpenAPI 3.x specification file. This\n specification is treated as the authoritative API contract.\n routes_module (ModuleType):\n Python module containing handler functions whose names correspond\n exactly to OpenAPI ``operationId`` values.\n **fastapi_kwargs (Any):\n Additional keyword arguments passed directly to\n ``fastapi.FastAPI`` (e.g., title, version, middleware, lifespan\n handlers).\n\nRaises:\n OpenAPIFirstError:\n If the OpenAPI specification is invalid, or if any declared\n ``operationId`` does not have a corresponding handler function.\n\nNotes:\n **Responsibilities:**\n\n - `OpenAPIFirstApp` subclasses `FastAPI` and replaces manual route\n registration with OpenAPI-driven binding.\n - All routes are derived from the provided OpenAPI specification,\n and each ``operationId`` is mapped to a Python function in the\n supplied routes module.\n - Auth dependencies are auto-injected from the spec's\n ``securitySchemes`` and per-operation ``security`` fields.\n\n **Guarantees:**\n\n - No route can exist without an OpenAPI declaration.\n - No OpenAPI operation can exist without a handler.\n - Swagger UI and ``/openapi.json`` always reflect the provided spec.\n - Handler functions remain framework-agnostic and testable.\n - Auth enforcement is driven entirely by the spec — no manual\n middleware or decorators required.\n\nExample:\n ```python\n from openapi_first.app import OpenAPIFirstApp\n import app.routes as routes\n\n app = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n )\n ```",
"members": {
"openapi": {
"name": "openapi",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.main.OpenAPIFirstApp.openapi",
"signature": null,
"docstring": null
}
}
},
"app": {
"name": "app",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.main.app",
"signature": null,
"docstring": null
}
}
}
}

View File

@@ -0,0 +1,44 @@
{
"module": "openapi_first.templates.crud_app.routes",
"content": {
"path": "openapi_first.templates.crud_app.routes",
"docstring": "CRUD route handlers bound via OpenAPI operationId.\n\nThese handlers explicitly control HTTP status codes to ensure\nruntime behavior matches the OpenAPI contract.\n\nThis module defines OpenAPI-bound operation handlers for a simple CRUD\nservice. Functions in this module are bound to HTTP routes exclusively\nvia OpenAPI ``operationId`` values.\n\nHandlers explicitly control HTTP response status codes to ensure runtime\nbehavior matches the OpenAPI contract. Error conditions are translated\ninto explicit HTTP responses rather than relying on implicit framework\nbehavior.\n\nNo routing decorators or path definitions appear in this module. All\nrouting, HTTP methods, and schemas are defined in the OpenAPI\nspecification.",
"objects": {
"list_items": {
"name": "list_items",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.list_items",
"signature": "list_items() -> list[dict]",
"docstring": "List all items.\n\nImplements the OpenAPI operation identified by\n``operationId: list_items``.\n\nReturns\n-------\nlist[dict]\n A list of item representations."
},
"get_item": {
"name": "get_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.get_item",
"signature": "get_item(item_id: int) -> dict",
"docstring": "Retrieve a single item by ID.\n\nImplements the OpenAPI operation identified by\n``operationId: get_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to retrieve.\n\nReturns\n-------\ndict\n The requested item.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
},
"create_item": {
"name": "create_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.create_item",
"signature": "create_item(payload: dict, response: Response) -> dict",
"docstring": "Create a new item.\n\nImplements the OpenAPI operation identified by\n``operationId: create_item``.\n\nParameters\n----------\npayload : dict\n Item attributes excluding the ``id`` field.\nresponse : Response\n Response object used to set the HTTP status code.\n\nReturns\n-------\ndict\n The newly created item."
},
"update_item": {
"name": "update_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.update_item",
"signature": "update_item(item_id: int, payload: dict) -> dict",
"docstring": "Update an existing item.\n\nImplements the OpenAPI operation identified by\n``operationId: update_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to update.\npayload : dict\n Item attributes excluding the ``id`` field.\n\nReturns\n-------\ndict\n The updated item.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
},
"delete_item": {
"name": "delete_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.routes.delete_item",
"signature": "delete_item(item_id: int, response: Response) -> None",
"docstring": "Delete an existing item.\n\nImplements the OpenAPI operation identified by\n``operationId: delete_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to delete.\nresponse : Response\n Response object used to set the HTTP status code.\n\nReturns\n-------\nNone\n No content.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
}
}
}
}

View File

@@ -0,0 +1,102 @@
{
"module": "openapi_first.templates.crud_app.test_crud_app",
"content": {
"path": "openapi_first.templates.crud_app.test_crud_app",
"docstring": "End-to-end tests for the OpenAPI-first CRUD example app.\n\nThese tests validate that all CRUD operations behave correctly\nagainst the in-memory mock data store.\n- OpenAPI specification loading\n- OperationId-driven route binding on the server\n- OperationId-driven client invocation\n- Correct HTTP status codes and response payloads\n\nThe tests exercise all CRUD operations against an in-memory mock data\nstore and assume deterministic behavior within a single process.\n\nThe tests assume:\n- OpenAPI-first route binding\n- In-memory storage (no persistence guarantees)\n- Deterministic behavior in a single process\n- One-to-one correspondence between OpenAPI operationId values and\n server/client callables",
"objects": {
"load_openapi": {
"name": "load_openapi",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.load_openapi",
"signature": "load_openapi(path: str | Path)",
"docstring": "Load and validate an OpenAPI 3.x specification from disk.\n\nArgs:\n path (str | Path):\n Filesystem path to an OpenAPI specification file. Supported\n extensions: `.json`, `.yaml`, `.yml`.\n\nReturns:\n dict[str, Any]:\n Parsed and validated OpenAPI specification.\n\nRaises:\n OpenAPISpecLoadError:\n If the file does not exist, cannot be parsed, or fails OpenAPI\n schema validation.\n\nNotes:\n **Guarantees:**\n\n - The specification is parsed based on file extension and validated\n using a strict OpenAPI schema validator.\n - Any error results in an immediate exception, preventing\n application startup."
},
"OpenAPIClient": {
"name": "OpenAPIClient",
"kind": "class",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient",
"signature": "OpenAPIClient(spec: dict[str, Any], base_url: str | None = None, client: httpx.Client | None = None)",
"docstring": "OpenAPI-first HTTP client (`httpx`-based).\n\nArgs:\n spec (dict[str, Any]):\n Parsed OpenAPI 3.x specification.\n base_url (str | None):\n Base URL of the target service. If omitted, the first entry in the\n OpenAPI `servers` list is used.\n client (httpx.Client | None):\n Optional preconfigured httpx client instance.\n\nRaises:\n OpenAPIClientError:\n If no servers are defined, spec has no paths, operationIds are\n missing/duplicate, or required parameters are missing.\n\nNotes:\n **Responsibilities:**\n\n - This client derives all callable methods directly from an\n OpenAPI 3.x specification. Each `operationId` becomes a method\n on the client instance.\n\n **Guarantees:**\n\n - One callable per `operationId`.\n - Explicit parameters (path, query, headers, body).\n - No implicit schema inference or mutation.\n - Returns raw `httpx.Response` objects.\n - No response validation or deserialization.\n\nExample:\n ```python\n from openapi_first import loader, client\n\n spec = loader.load_openapi(\"openapi.yaml\")\n\n api = client.OpenAPIClient(\n spec=spec,\n base_url=\"http://localhost:8000\",\n )\n\n # Call operationId: getUser\n response = api.getUser(\n path_params={\"user_id\": 123}\n )\n\n print(response.status_code)\n print(response.json())\n ```",
"members": {
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.spec",
"signature": null,
"docstring": null
},
"base_url": {
"name": "base_url",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.base_url",
"signature": null,
"docstring": null
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.client",
"signature": null,
"docstring": null
},
"operations": {
"name": "operations",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.OpenAPIClient.operations",
"signature": "operations()",
"docstring": null
}
}
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.client",
"signature": null,
"docstring": null
},
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.templates.crud_app.test_crud_app.spec",
"signature": null,
"docstring": null
},
"test_list_items_initial": {
"name": "test_list_items_initial",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_list_items_initial",
"signature": "test_list_items_initial()",
"docstring": "Initial items should be present."
},
"test_get_item": {
"name": "test_get_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_get_item",
"signature": "test_get_item()",
"docstring": "Existing item should be retrievable by ID."
},
"test_create_item": {
"name": "test_create_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_create_item",
"signature": "test_create_item()",
"docstring": "Creating a new item should return the created entity."
},
"test_update_item": {
"name": "test_update_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_update_item",
"signature": "test_update_item()",
"docstring": "Updating an item should replace its values."
},
"test_delete_item": {
"name": "test_delete_item",
"kind": "function",
"path": "openapi_first.templates.crud_app.test_crud_app.test_delete_item",
"signature": "test_delete_item()",
"docstring": "Deleting an item should remove it from the store."
}
}
}
}

View File

@@ -0,0 +1,57 @@
{
"module": "openapi_first.templates.health_app",
"content": {
"path": "openapi_first.templates.health_app",
"docstring": "OpenAPI-first FastAPI application template.\n\nThis package contains a minimal, fully working example of an\nOpenAPI-first FastAPI service built using the ``openapi_first`` library.\n\nThe application is assembled exclusively from:\n- an OpenAPI specification (``openapi.yaml``)\n- a handler namespace (``routes``)\n\nNo routing decorators, implicit behavior, or framework-specific\nconvenience abstractions are used. All HTTP routes, methods, and\noperation bindings are defined in OpenAPI and enforced at application\nstartup.\n\nThis package is intended to be copied as a starting point for new\nservices via the ``openapi-first`` CLI. It is not part of the\n``openapi_first`` library API surface.\n\n----------------------------------------------------------------------\nScaffolding via CLI\n----------------------------------------------------------------------\n\nCreate a new OpenAPI-first health check service using the bundled\ntemplate:\n\n openapi-first scaffold health_app\n\nCreate the service in a custom directory:\n\n openapi-first scaffold health_app my-health-service\n\nList all available application templates:\n\n openapi-first scaffold --list\n\nThe CLI copies template files verbatim into the target directory.\nNo code is generated or modified beyond the copied scaffold.\n\n----------------------------------------------------------------------\nClient Usage Example\n----------------------------------------------------------------------\n\nThe same OpenAPI specification used by the server can be used to\nconstruct a strict, operationId-driven HTTP client.\n\nExample client call for the ``get_health`` operation:\n\n from openapi_first.loader import load_openapi\n from openapi_first.client import OpenAPIClient\n\n spec = load_openapi(\"openapi.yaml\")\n client = OpenAPIClient(spec)\n\n response = client.get_health()\n\n assert response.status_code == 200\n assert response.json() == {\"status\": \"ok\"}\n\nClient guarantees:\n- One callable per OpenAPI ``operationId``\n- No hardcoded URLs or HTTP methods in user code\n- Path and request parameters must match the OpenAPI specification\n- Invalid or incomplete OpenAPI specs fail at client construction time",
"objects": {
"main": {
"name": "main",
"kind": "module",
"path": "openapi_first.templates.health_app.main",
"signature": null,
"docstring": "Application entry point for an OpenAPI-first FastAPI service.\n\nThis module constructs a FastAPI application exclusively from an\nOpenAPI specification and a handler namespace, without using\ndecorator-driven routing.\n\nAll HTTP routes, methods, and operation bindings are defined in the\nOpenAPI document referenced by ``openapi_path``. Python callables\ndefined in the ``routes`` module are bound to OpenAPI operations\nstrictly via ``operationId``.\n\nThis module contains no routing logic, request handling, or framework\nconfiguration beyond application assembly.\n\nDesign guarantees:\n- OpenAPI is the single source of truth\n- No undocumented routes can exist\n- Every OpenAPI operationId must resolve to exactly one handler\n- All contract violations fail at application startup\n\nThis file is intended to be used as the ASGI entry point.\n\nExample:\n uvicorn main:app",
"members": {
"OpenAPIFirstApp": {
"name": "OpenAPIFirstApp",
"kind": "class",
"path": "openapi_first.templates.health_app.main.OpenAPIFirstApp",
"signature": "OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)",
"docstring": "FastAPI application enforcing OpenAPI-first design.\n\nArgs:\n openapi_path (str):\n Filesystem path to the OpenAPI 3.x specification file. This\n specification is treated as the authoritative API contract.\n routes_module (ModuleType):\n Python module containing handler functions whose names correspond\n exactly to OpenAPI ``operationId`` values.\n **fastapi_kwargs (Any):\n Additional keyword arguments passed directly to\n ``fastapi.FastAPI`` (e.g., title, version, middleware, lifespan\n handlers).\n\nRaises:\n OpenAPIFirstError:\n If the OpenAPI specification is invalid, or if any declared\n ``operationId`` does not have a corresponding handler function.\n\nNotes:\n **Responsibilities:**\n\n - `OpenAPIFirstApp` subclasses `FastAPI` and replaces manual route\n registration with OpenAPI-driven binding.\n - All routes are derived from the provided OpenAPI specification,\n and each ``operationId`` is mapped to a Python function in the\n supplied routes module.\n - Auth dependencies are auto-injected from the spec's\n ``securitySchemes`` and per-operation ``security`` fields.\n\n **Guarantees:**\n\n - No route can exist without an OpenAPI declaration.\n - No OpenAPI operation can exist without a handler.\n - Swagger UI and ``/openapi.json`` always reflect the provided spec.\n - Handler functions remain framework-agnostic and testable.\n - Auth enforcement is driven entirely by the spec — no manual\n middleware or decorators required.\n\nExample:\n ```python\n from openapi_first.app import OpenAPIFirstApp\n import app.routes as routes\n\n app = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n )\n ```",
"members": {
"openapi": {
"name": "openapi",
"kind": "attribute",
"path": "openapi_first.templates.health_app.main.OpenAPIFirstApp.openapi",
"signature": null,
"docstring": null
}
}
},
"app": {
"name": "app",
"kind": "attribute",
"path": "openapi_first.templates.health_app.main.app",
"signature": null,
"docstring": null
}
}
},
"routes": {
"name": "routes",
"kind": "module",
"path": "openapi_first.templates.health_app.routes",
"signature": null,
"docstring": "OpenAPI operation handlers.\n\nThis module defines pure Python callables that implement OpenAPI\noperations for this service. Functions in this module are bound to HTTP\nroutes exclusively via OpenAPI ``operationId`` values.\n\nNo routing decorators, HTTP metadata, or framework-specific logic\nshould appear here. All request/response semantics are defined in the\nOpenAPI specification.\n\nThis module serves solely as an operationId namespace.",
"members": {
"get_health": {
"name": "get_health",
"kind": "function",
"path": "openapi_first.templates.health_app.routes.get_health",
"signature": "get_health() -> dict",
"docstring": "Health check operation handler.\n\nThis function implements the OpenAPI operation identified by\n``operationId: get_health``.\n\nIt contains no routing metadata or framework-specific logic.\nRequest binding, HTTP method, and response semantics are defined\nexclusively by the OpenAPI specification.\n\nReturns\n-------\ndict\n A minimal liveness payload indicating service health."
}
}
}
}
}
}

View File

@@ -0,0 +1,32 @@
{
"module": "openapi_first.templates.health_app.main",
"content": {
"path": "openapi_first.templates.health_app.main",
"docstring": "Application entry point for an OpenAPI-first FastAPI service.\n\nThis module constructs a FastAPI application exclusively from an\nOpenAPI specification and a handler namespace, without using\ndecorator-driven routing.\n\nAll HTTP routes, methods, and operation bindings are defined in the\nOpenAPI document referenced by ``openapi_path``. Python callables\ndefined in the ``routes`` module are bound to OpenAPI operations\nstrictly via ``operationId``.\n\nThis module contains no routing logic, request handling, or framework\nconfiguration beyond application assembly.\n\nDesign guarantees:\n- OpenAPI is the single source of truth\n- No undocumented routes can exist\n- Every OpenAPI operationId must resolve to exactly one handler\n- All contract violations fail at application startup\n\nThis file is intended to be used as the ASGI entry point.\n\nExample:\n uvicorn main:app",
"objects": {
"OpenAPIFirstApp": {
"name": "OpenAPIFirstApp",
"kind": "class",
"path": "openapi_first.templates.health_app.main.OpenAPIFirstApp",
"signature": "OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)",
"docstring": "FastAPI application enforcing OpenAPI-first design.\n\nArgs:\n openapi_path (str):\n Filesystem path to the OpenAPI 3.x specification file. This\n specification is treated as the authoritative API contract.\n routes_module (ModuleType):\n Python module containing handler functions whose names correspond\n exactly to OpenAPI ``operationId`` values.\n **fastapi_kwargs (Any):\n Additional keyword arguments passed directly to\n ``fastapi.FastAPI`` (e.g., title, version, middleware, lifespan\n handlers).\n\nRaises:\n OpenAPIFirstError:\n If the OpenAPI specification is invalid, or if any declared\n ``operationId`` does not have a corresponding handler function.\n\nNotes:\n **Responsibilities:**\n\n - `OpenAPIFirstApp` subclasses `FastAPI` and replaces manual route\n registration with OpenAPI-driven binding.\n - All routes are derived from the provided OpenAPI specification,\n and each ``operationId`` is mapped to a Python function in the\n supplied routes module.\n - Auth dependencies are auto-injected from the spec's\n ``securitySchemes`` and per-operation ``security`` fields.\n\n **Guarantees:**\n\n - No route can exist without an OpenAPI declaration.\n - No OpenAPI operation can exist without a handler.\n - Swagger UI and ``/openapi.json`` always reflect the provided spec.\n - Handler functions remain framework-agnostic and testable.\n - Auth enforcement is driven entirely by the spec — no manual\n middleware or decorators required.\n\nExample:\n ```python\n from openapi_first.app import OpenAPIFirstApp\n import app.routes as routes\n\n app = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n )\n ```",
"members": {
"openapi": {
"name": "openapi",
"kind": "attribute",
"path": "openapi_first.templates.health_app.main.OpenAPIFirstApp.openapi",
"signature": null,
"docstring": null
}
}
},
"app": {
"name": "app",
"kind": "attribute",
"path": "openapi_first.templates.health_app.main.app",
"signature": null,
"docstring": null
}
}
}
}

View File

@@ -0,0 +1,16 @@
{
"module": "openapi_first.templates.health_app.routes",
"content": {
"path": "openapi_first.templates.health_app.routes",
"docstring": "OpenAPI operation handlers.\n\nThis module defines pure Python callables that implement OpenAPI\noperations for this service. Functions in this module are bound to HTTP\nroutes exclusively via OpenAPI ``operationId`` values.\n\nNo routing decorators, HTTP metadata, or framework-specific logic\nshould appear here. All request/response semantics are defined in the\nOpenAPI specification.\n\nThis module serves solely as an operationId namespace.",
"objects": {
"get_health": {
"name": "get_health",
"kind": "function",
"path": "openapi_first.templates.health_app.routes.get_health",
"signature": "get_health() -> dict",
"docstring": "Health check operation handler.\n\nThis function implements the OpenAPI operation identified by\n``operationId: get_health``.\n\nIt contains no routing metadata or framework-specific logic.\nRequest binding, HTTP method, and response semantics are defined\nexclusively by the OpenAPI specification.\n\nReturns\n-------\ndict\n A minimal liveness payload indicating service health."
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
{
"module": "openapi_first.templates.model_app.data",
"content": {
"path": "openapi_first.templates.model_app.data",
"docstring": "In-memory data store using Pydantic models.\n\nThis module is NOT thread-safe and is intended for demos and scaffolds only.\nThis module provides a minimal, process-local data store for the\nmodel-based CRUD example application. It stores and returns domain\nobjects defined using Pydantic models and is intended solely for\ndemonstration and scaffolding purposes.\n\nThe implementation intentionally avoids:\n- persistence\n- concurrency guarantees\n- transactional semantics\n- validation beyond what Pydantic provides\n\nIt is not part of the ``openapi_first`` library API surface.",
"objects": {
"list_items": {
"name": "list_items",
"kind": "function",
"path": "openapi_first.templates.model_app.data.list_items",
"signature": "list_items() -> list[Item]",
"docstring": "Return all items in the data store.\n\nReturns\n-------\nlist[Item]\n A list of item domain objects."
},
"get_item": {
"name": "get_item",
"kind": "function",
"path": "openapi_first.templates.model_app.data.get_item",
"signature": "get_item(item_id: int) -> Item",
"docstring": "Retrieve a single item by ID.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to retrieve.\n\nReturns\n-------\nItem\n The requested item.\n\nRaises\n------\nKeyError\n If the item does not exist."
},
"create_item": {
"name": "create_item",
"kind": "function",
"path": "openapi_first.templates.model_app.data.create_item",
"signature": "create_item(payload: ItemCreate) -> Item",
"docstring": "Create a new item in the data store.\n\nA new identifier is assigned automatically. No additional validation\nis performed beyond Pydantic model validation.\n\nParameters\n----------\npayload : ItemCreate\n Data required to create a new item.\n\nReturns\n-------\nItem\n The newly created item."
},
"update_item": {
"name": "update_item",
"kind": "function",
"path": "openapi_first.templates.model_app.data.update_item",
"signature": "update_item(item_id: int, payload: ItemCreate) -> Item",
"docstring": "Replace an existing item in the data store.\n\nThis function performs a full replacement of the stored item.\nPartial updates are not supported.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to update.\npayload : ItemCreate\n New item data.\n\nReturns\n-------\nItem\n The updated item.\n\nRaises\n------\nKeyError\n If the item does not exist."
},
"delete_item": {
"name": "delete_item",
"kind": "function",
"path": "openapi_first.templates.model_app.data.delete_item",
"signature": "delete_item(item_id: int) -> None",
"docstring": "Remove an item from the data store.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to delete.\n\nRaises\n------\nKeyError\n If the item does not exist."
}
}
}
}

View File

@@ -0,0 +1,286 @@
{
"module": "openapi_first.templates.model_app",
"content": {
"path": "openapi_first.templates.model_app",
"docstring": "OpenAPI-first model-based CRUD application template.\n\nThis package contains a complete, minimal example of an OpenAPI-first\nCRUD service that uses explicit Pydantic domain models for request and\nresponse schemas.\n\nThe application is assembled exclusively from:\n- an OpenAPI specification (``openapi.yaml``)\n- a handler namespace implementing CRUD operations (``routes``)\n- Pydantic domain models (``models``)\n- an in-memory mock data store (``data``)\n\nAll HTTP routes, methods, schemas, and operation bindings are defined\nin the OpenAPI specification and enforced at application startup.\nNo decorator-driven routing or implicit framework behavior is used.\n\nThis template demonstrates:\n- operationId-driven server-side route binding\n- explicit request and response modeling with Pydantic\n- explicit HTTP status code control in handlers\n- operationId-driven client usage against the same OpenAPI contract\n- end-to-end validation using in-memory data and tests\n\n----------------------------------------------------------------------\nScaffolding via CLI\n----------------------------------------------------------------------\n\nCreate a new model-based CRUD example service using the bundled template:\n\n openapi-first scaffold model_app\n\nCreate the service in a custom directory:\n\n openapi-first scaffold model_app my-model-service\n\nList all available application templates:\n\n openapi-first scaffold --list\n\nThe CLI copies template files verbatim into the target directory.\nNo code is generated or modified beyond the copied scaffold.\n\n----------------------------------------------------------------------\nClient Usage Example\n----------------------------------------------------------------------\n\nThe same OpenAPI specification used by the server can be used to\nconstruct a strict, operationId-driven HTTP client.\n\nExample client calls for model-based CRUD operations:\n\n from openapi_first.loader import load_openapi\n from openapi_first.client import OpenAPIClient\n\n spec = load_openapi(\"openapi.yaml\")\n client = OpenAPIClient(spec)\n\n # List items\n response = client.list_items()\n\n # Get item by ID\n response = client.get_item(\n path_params={\"item_id\": 1}\n )\n\n # Create item\n response = client.create_item(\n body={\"name\": \"Orange\", \"price\": 0.8}\n )\n\n # Update item\n response = client.update_item(\n path_params={\"item_id\": 1},\n body={\"name\": \"Green Apple\", \"price\": 0.6},\n )\n\n # Delete item\n response = client.delete_item(\n path_params={\"item_id\": 1}\n )\n\nClient guarantees:\n- One callable per OpenAPI ``operationId``\n- No hardcoded URLs or HTTP methods in user code\n- Request and response payloads conform to Pydantic models\n- Invalid or incomplete OpenAPI specs fail at client construction time\n\n----------------------------------------------------------------------\nNon-Goals\n----------------------------------------------------------------------\n\nThis template is intentionally minimal and is NOT:\n- production-ready\n- persistent or concurrency-safe\n- a reference architecture for data storage\n\nIt exists solely as a copyable example for learning, testing, and\nbootstrapping OpenAPI-first services.\n\nThis package is not part of the ``openapi_first`` library API surface.",
"objects": {
"data": {
"name": "data",
"kind": "module",
"path": "openapi_first.templates.model_app.data",
"signature": null,
"docstring": "In-memory data store using Pydantic models.\n\nThis module is NOT thread-safe and is intended for demos and scaffolds only.\nThis module provides a minimal, process-local data store for the\nmodel-based CRUD example application. It stores and returns domain\nobjects defined using Pydantic models and is intended solely for\ndemonstration and scaffolding purposes.\n\nThe implementation intentionally avoids:\n- persistence\n- concurrency guarantees\n- transactional semantics\n- validation beyond what Pydantic provides\n\nIt is not part of the ``openapi_first`` library API surface.",
"members": {
"list_items": {
"name": "list_items",
"kind": "function",
"path": "openapi_first.templates.model_app.data.list_items",
"signature": "list_items() -> list[Item]",
"docstring": "Return all items in the data store.\n\nReturns\n-------\nlist[Item]\n A list of item domain objects."
},
"get_item": {
"name": "get_item",
"kind": "function",
"path": "openapi_first.templates.model_app.data.get_item",
"signature": "get_item(item_id: int) -> Item",
"docstring": "Retrieve a single item by ID.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to retrieve.\n\nReturns\n-------\nItem\n The requested item.\n\nRaises\n------\nKeyError\n If the item does not exist."
},
"create_item": {
"name": "create_item",
"kind": "function",
"path": "openapi_first.templates.model_app.data.create_item",
"signature": "create_item(payload: ItemCreate) -> Item",
"docstring": "Create a new item in the data store.\n\nA new identifier is assigned automatically. No additional validation\nis performed beyond Pydantic model validation.\n\nParameters\n----------\npayload : ItemCreate\n Data required to create a new item.\n\nReturns\n-------\nItem\n The newly created item."
},
"update_item": {
"name": "update_item",
"kind": "function",
"path": "openapi_first.templates.model_app.data.update_item",
"signature": "update_item(item_id: int, payload: ItemCreate) -> Item",
"docstring": "Replace an existing item in the data store.\n\nThis function performs a full replacement of the stored item.\nPartial updates are not supported.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to update.\npayload : ItemCreate\n New item data.\n\nReturns\n-------\nItem\n The updated item.\n\nRaises\n------\nKeyError\n If the item does not exist."
},
"delete_item": {
"name": "delete_item",
"kind": "function",
"path": "openapi_first.templates.model_app.data.delete_item",
"signature": "delete_item(item_id: int) -> None",
"docstring": "Remove an item from the data store.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to delete.\n\nRaises\n------\nKeyError\n If the item does not exist."
}
}
},
"main": {
"name": "main",
"kind": "module",
"path": "openapi_first.templates.model_app.main",
"signature": null,
"docstring": "Application entry point for an OpenAPI-first model-based CRUD example service.\n\nThis module constructs a FastAPI application exclusively from an\nOpenAPI specification and a handler namespace, without using\ndecorator-driven routing.\n\nAll HTTP routes, methods, request/response schemas, and operation\nbindings are defined in the OpenAPI document referenced by\n``openapi_path``. Python callables defined in the ``routes`` module are\nbound to OpenAPI operations strictly via ``operationId``.\n\nThis module contains no routing logic, persistence concerns, or\nframework configuration beyond application assembly.\n\nDesign guarantees:\n- OpenAPI is the single source of truth\n- No undocumented routes can exist\n- Every OpenAPI operationId must resolve to exactly one handler\n- All contract violations fail at application startup\n\nThis file is intended to be used as the ASGI entry point.\n\nExample:\n uvicorn main:app",
"members": {
"OpenAPIFirstApp": {
"name": "OpenAPIFirstApp",
"kind": "class",
"path": "openapi_first.templates.model_app.main.OpenAPIFirstApp",
"signature": "OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)",
"docstring": "FastAPI application enforcing OpenAPI-first design.\n\nArgs:\n openapi_path (str):\n Filesystem path to the OpenAPI 3.x specification file. This\n specification is treated as the authoritative API contract.\n routes_module (ModuleType):\n Python module containing handler functions whose names correspond\n exactly to OpenAPI ``operationId`` values.\n **fastapi_kwargs (Any):\n Additional keyword arguments passed directly to\n ``fastapi.FastAPI`` (e.g., title, version, middleware, lifespan\n handlers).\n\nRaises:\n OpenAPIFirstError:\n If the OpenAPI specification is invalid, or if any declared\n ``operationId`` does not have a corresponding handler function.\n\nNotes:\n **Responsibilities:**\n\n - `OpenAPIFirstApp` subclasses `FastAPI` and replaces manual route\n registration with OpenAPI-driven binding.\n - All routes are derived from the provided OpenAPI specification,\n and each ``operationId`` is mapped to a Python function in the\n supplied routes module.\n - Auth dependencies are auto-injected from the spec's\n ``securitySchemes`` and per-operation ``security`` fields.\n\n **Guarantees:**\n\n - No route can exist without an OpenAPI declaration.\n - No OpenAPI operation can exist without a handler.\n - Swagger UI and ``/openapi.json`` always reflect the provided spec.\n - Handler functions remain framework-agnostic and testable.\n - Auth enforcement is driven entirely by the spec — no manual\n middleware or decorators required.\n\nExample:\n ```python\n from openapi_first.app import OpenAPIFirstApp\n import app.routes as routes\n\n app = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n )\n ```",
"members": {
"openapi": {
"name": "openapi",
"kind": "attribute",
"path": "openapi_first.templates.model_app.main.OpenAPIFirstApp.openapi",
"signature": null,
"docstring": null
}
}
},
"app": {
"name": "app",
"kind": "attribute",
"path": "openapi_first.templates.model_app.main.app",
"signature": null,
"docstring": null
}
}
},
"models": {
"name": "models",
"kind": "module",
"path": "openapi_first.templates.model_app.models",
"signature": null,
"docstring": "Pydantic domain models for the CRUD example.\n\nThis module defines Pydantic models that represent the domain entities\nused by the service. These models are referenced by the OpenAPI\nspecification for request and response schemas.\n\nThe models are declarative and framework-agnostic. They contain no\npersistence logic, validation beyond type constraints, or business\nbehavior.\n\nThis module is not part of the ``openapi_first`` library API surface.\nIt exists solely to support the example application template.",
"members": {
"ItemBase": {
"name": "ItemBase",
"kind": "class",
"path": "openapi_first.templates.model_app.models.ItemBase",
"signature": null,
"docstring": "Base domain model for an item.\n\nDefines fields common to all item representations.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "openapi_first.templates.model_app.models.ItemBase.name",
"signature": null,
"docstring": null
},
"price": {
"name": "price",
"kind": "attribute",
"path": "openapi_first.templates.model_app.models.ItemBase.price",
"signature": null,
"docstring": null
}
}
},
"ItemCreate": {
"name": "ItemCreate",
"kind": "class",
"path": "openapi_first.templates.model_app.models.ItemCreate",
"signature": null,
"docstring": "Domain model for item creation requests.\n\nThis model is used for request bodies when creating new items.\nIt intentionally excludes the ``id`` field, which is assigned\nby the service."
},
"Item": {
"name": "Item",
"kind": "class",
"path": "openapi_first.templates.model_app.models.Item",
"signature": null,
"docstring": "Domain model for a persisted item.\n\nThis model represents the full item state returned in responses,\nincluding the server-assigned identifier.",
"members": {
"id": {
"name": "id",
"kind": "attribute",
"path": "openapi_first.templates.model_app.models.Item.id",
"signature": null,
"docstring": null
}
}
}
}
},
"routes": {
"name": "routes",
"kind": "module",
"path": "openapi_first.templates.model_app.routes",
"signature": null,
"docstring": "CRUD route handlers bound via OpenAPI operationId.\n\nThis module defines OpenAPI-bound operation handlers for a model-based\nCRUD service. Functions in this module are bound to HTTP routes\nexclusively via OpenAPI ``operationId`` values.\n\nHandlers explicitly control HTTP response status codes to ensure runtime\nbehavior matches the OpenAPI contract. Domain models defined using\nPydantic are used for request and response payloads.\n\nNo routing decorators, path definitions, or implicit framework behavior\nappear in this module. All routing, HTTP methods, and schemas are defined\nin the OpenAPI specification.",
"members": {
"list_items": {
"name": "list_items",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.list_items",
"signature": "list_items() -> list[Item]",
"docstring": "List all items.\n\nImplements the OpenAPI operation identified by\n``operationId: list_items``.\n\nReturns\n-------\nlist[Item]\n A list of item domain objects."
},
"get_item": {
"name": "get_item",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.get_item",
"signature": "get_item(item_id: int) -> Item",
"docstring": "Retrieve a single item by ID.\n\nImplements the OpenAPI operation identified by\n``operationId: get_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to retrieve.\n\nReturns\n-------\nItem\n The requested item.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
},
"create_item": {
"name": "create_item",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.create_item",
"signature": "create_item(payload: ItemCreate, response: Response) -> Item",
"docstring": "Create a new item.\n\nImplements the OpenAPI operation identified by\n``operationId: create_item``.\n\nParameters\n----------\npayload : ItemCreate\n Request body describing the item to create.\nresponse : Response\n Response object used to set the HTTP status code.\n\nReturns\n-------\nItem\n The newly created item."
},
"update_item": {
"name": "update_item",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.update_item",
"signature": "update_item(item_id: int, payload: ItemCreate) -> Item",
"docstring": "Update an existing item.\n\nImplements the OpenAPI operation identified by\n``operationId: update_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to update.\npayload : ItemCreate\n New item data.\n\nReturns\n-------\nItem\n The updated item.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
},
"delete_item": {
"name": "delete_item",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.delete_item",
"signature": "delete_item(item_id: int, response: Response) -> None",
"docstring": "Delete an existing item.\n\nImplements the OpenAPI operation identified by\n``operationId: delete_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to delete.\nresponse : Response\n Response object used to set the HTTP status code.\n\nReturns\n-------\nNone\n No content.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
}
}
},
"test_model_app": {
"name": "test_model_app",
"kind": "module",
"path": "openapi_first.templates.model_app.test_model_app",
"signature": null,
"docstring": "End-to-end tests for the OpenAPI-first model CRUD example app.\n\nThese tests validate that all CRUD operations behave correctly\nagainst the in-memory mock data store using Pydantic models.\n- OpenAPI specification loading\n- OperationId-driven route binding on the server\n- OperationId-driven client invocation\n- Pydantic model-based request and response handling\n\nAll CRUD operations are exercised against an in-memory mock data store\nbacked by Pydantic domain models.\n\nThe tests assume:\n- OpenAPI-first route binding\n- Pydantic model validation\n- In-memory storage (no persistence guarantees)\n- Deterministic behavior in a single process",
"members": {
"load_openapi": {
"name": "load_openapi",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.load_openapi",
"signature": "load_openapi(path: str | Path)",
"docstring": "Load and validate an OpenAPI 3.x specification from disk.\n\nArgs:\n path (str | Path):\n Filesystem path to an OpenAPI specification file. Supported\n extensions: `.json`, `.yaml`, `.yml`.\n\nReturns:\n dict[str, Any]:\n Parsed and validated OpenAPI specification.\n\nRaises:\n OpenAPISpecLoadError:\n If the file does not exist, cannot be parsed, or fails OpenAPI\n schema validation.\n\nNotes:\n **Guarantees:**\n\n - The specification is parsed based on file extension and validated\n using a strict OpenAPI schema validator.\n - Any error results in an immediate exception, preventing\n application startup."
},
"OpenAPIClient": {
"name": "OpenAPIClient",
"kind": "class",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient",
"signature": "OpenAPIClient(spec: dict[str, Any], base_url: str | None = None, client: httpx.Client | None = None)",
"docstring": "OpenAPI-first HTTP client (`httpx`-based).\n\nArgs:\n spec (dict[str, Any]):\n Parsed OpenAPI 3.x specification.\n base_url (str | None):\n Base URL of the target service. If omitted, the first entry in the\n OpenAPI `servers` list is used.\n client (httpx.Client | None):\n Optional preconfigured httpx client instance.\n\nRaises:\n OpenAPIClientError:\n If no servers are defined, spec has no paths, operationIds are\n missing/duplicate, or required parameters are missing.\n\nNotes:\n **Responsibilities:**\n\n - This client derives all callable methods directly from an\n OpenAPI 3.x specification. Each `operationId` becomes a method\n on the client instance.\n\n **Guarantees:**\n\n - One callable per `operationId`.\n - Explicit parameters (path, query, headers, body).\n - No implicit schema inference or mutation.\n - Returns raw `httpx.Response` objects.\n - No response validation or deserialization.\n\nExample:\n ```python\n from openapi_first import loader, client\n\n spec = loader.load_openapi(\"openapi.yaml\")\n\n api = client.OpenAPIClient(\n spec=spec,\n base_url=\"http://localhost:8000\",\n )\n\n # Call operationId: getUser\n response = api.getUser(\n path_params={\"user_id\": 123}\n )\n\n print(response.status_code)\n print(response.json())\n ```",
"members": {
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient.spec",
"signature": null,
"docstring": null
},
"base_url": {
"name": "base_url",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient.base_url",
"signature": null,
"docstring": null
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient.client",
"signature": null,
"docstring": null
},
"operations": {
"name": "operations",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient.operations",
"signature": "operations()",
"docstring": null
}
}
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.client",
"signature": null,
"docstring": null
},
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.spec",
"signature": null,
"docstring": null
},
"test_list_items_initial": {
"name": "test_list_items_initial",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_list_items_initial",
"signature": "test_list_items_initial()",
"docstring": "Initial items should be present."
},
"test_get_item": {
"name": "test_get_item",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_get_item",
"signature": "test_get_item()",
"docstring": "Existing item should be retrievable by ID."
},
"test_create_item": {
"name": "test_create_item",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_create_item",
"signature": "test_create_item()",
"docstring": "Creating a new item should return the created entity."
},
"test_update_item": {
"name": "test_update_item",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_update_item",
"signature": "test_update_item()",
"docstring": "Updating an item should replace its values."
},
"test_delete_item": {
"name": "test_delete_item",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_delete_item",
"signature": "test_delete_item()",
"docstring": "Deleting an item should remove it from the store."
}
}
}
}
}
}

View File

@@ -0,0 +1,32 @@
{
"module": "openapi_first.templates.model_app.main",
"content": {
"path": "openapi_first.templates.model_app.main",
"docstring": "Application entry point for an OpenAPI-first model-based CRUD example service.\n\nThis module constructs a FastAPI application exclusively from an\nOpenAPI specification and a handler namespace, without using\ndecorator-driven routing.\n\nAll HTTP routes, methods, request/response schemas, and operation\nbindings are defined in the OpenAPI document referenced by\n``openapi_path``. Python callables defined in the ``routes`` module are\nbound to OpenAPI operations strictly via ``operationId``.\n\nThis module contains no routing logic, persistence concerns, or\nframework configuration beyond application assembly.\n\nDesign guarantees:\n- OpenAPI is the single source of truth\n- No undocumented routes can exist\n- Every OpenAPI operationId must resolve to exactly one handler\n- All contract violations fail at application startup\n\nThis file is intended to be used as the ASGI entry point.\n\nExample:\n uvicorn main:app",
"objects": {
"OpenAPIFirstApp": {
"name": "OpenAPIFirstApp",
"kind": "class",
"path": "openapi_first.templates.model_app.main.OpenAPIFirstApp",
"signature": "OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)",
"docstring": "FastAPI application enforcing OpenAPI-first design.\n\nArgs:\n openapi_path (str):\n Filesystem path to the OpenAPI 3.x specification file. This\n specification is treated as the authoritative API contract.\n routes_module (ModuleType):\n Python module containing handler functions whose names correspond\n exactly to OpenAPI ``operationId`` values.\n **fastapi_kwargs (Any):\n Additional keyword arguments passed directly to\n ``fastapi.FastAPI`` (e.g., title, version, middleware, lifespan\n handlers).\n\nRaises:\n OpenAPIFirstError:\n If the OpenAPI specification is invalid, or if any declared\n ``operationId`` does not have a corresponding handler function.\n\nNotes:\n **Responsibilities:**\n\n - `OpenAPIFirstApp` subclasses `FastAPI` and replaces manual route\n registration with OpenAPI-driven binding.\n - All routes are derived from the provided OpenAPI specification,\n and each ``operationId`` is mapped to a Python function in the\n supplied routes module.\n - Auth dependencies are auto-injected from the spec's\n ``securitySchemes`` and per-operation ``security`` fields.\n\n **Guarantees:**\n\n - No route can exist without an OpenAPI declaration.\n - No OpenAPI operation can exist without a handler.\n - Swagger UI and ``/openapi.json`` always reflect the provided spec.\n - Handler functions remain framework-agnostic and testable.\n - Auth enforcement is driven entirely by the spec — no manual\n middleware or decorators required.\n\nExample:\n ```python\n from openapi_first.app import OpenAPIFirstApp\n import app.routes as routes\n\n app = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n )\n ```",
"members": {
"openapi": {
"name": "openapi",
"kind": "attribute",
"path": "openapi_first.templates.model_app.main.OpenAPIFirstApp.openapi",
"signature": null,
"docstring": null
}
}
},
"app": {
"name": "app",
"kind": "attribute",
"path": "openapi_first.templates.model_app.main.app",
"signature": null,
"docstring": null
}
}
}
}

View File

@@ -0,0 +1,55 @@
{
"module": "openapi_first.templates.model_app.models",
"content": {
"path": "openapi_first.templates.model_app.models",
"docstring": "Pydantic domain models for the CRUD example.\n\nThis module defines Pydantic models that represent the domain entities\nused by the service. These models are referenced by the OpenAPI\nspecification for request and response schemas.\n\nThe models are declarative and framework-agnostic. They contain no\npersistence logic, validation beyond type constraints, or business\nbehavior.\n\nThis module is not part of the ``openapi_first`` library API surface.\nIt exists solely to support the example application template.",
"objects": {
"ItemBase": {
"name": "ItemBase",
"kind": "class",
"path": "openapi_first.templates.model_app.models.ItemBase",
"signature": null,
"docstring": "Base domain model for an item.\n\nDefines fields common to all item representations.",
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "openapi_first.templates.model_app.models.ItemBase.name",
"signature": null,
"docstring": null
},
"price": {
"name": "price",
"kind": "attribute",
"path": "openapi_first.templates.model_app.models.ItemBase.price",
"signature": null,
"docstring": null
}
}
},
"ItemCreate": {
"name": "ItemCreate",
"kind": "class",
"path": "openapi_first.templates.model_app.models.ItemCreate",
"signature": null,
"docstring": "Domain model for item creation requests.\n\nThis model is used for request bodies when creating new items.\nIt intentionally excludes the ``id`` field, which is assigned\nby the service."
},
"Item": {
"name": "Item",
"kind": "class",
"path": "openapi_first.templates.model_app.models.Item",
"signature": null,
"docstring": "Domain model for a persisted item.\n\nThis model represents the full item state returned in responses,\nincluding the server-assigned identifier.",
"members": {
"id": {
"name": "id",
"kind": "attribute",
"path": "openapi_first.templates.model_app.models.Item.id",
"signature": null,
"docstring": null
}
}
}
}
}
}

View File

@@ -0,0 +1,44 @@
{
"module": "openapi_first.templates.model_app.routes",
"content": {
"path": "openapi_first.templates.model_app.routes",
"docstring": "CRUD route handlers bound via OpenAPI operationId.\n\nThis module defines OpenAPI-bound operation handlers for a model-based\nCRUD service. Functions in this module are bound to HTTP routes\nexclusively via OpenAPI ``operationId`` values.\n\nHandlers explicitly control HTTP response status codes to ensure runtime\nbehavior matches the OpenAPI contract. Domain models defined using\nPydantic are used for request and response payloads.\n\nNo routing decorators, path definitions, or implicit framework behavior\nappear in this module. All routing, HTTP methods, and schemas are defined\nin the OpenAPI specification.",
"objects": {
"list_items": {
"name": "list_items",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.list_items",
"signature": "list_items() -> list[Item]",
"docstring": "List all items.\n\nImplements the OpenAPI operation identified by\n``operationId: list_items``.\n\nReturns\n-------\nlist[Item]\n A list of item domain objects."
},
"get_item": {
"name": "get_item",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.get_item",
"signature": "get_item(item_id: int) -> Item",
"docstring": "Retrieve a single item by ID.\n\nImplements the OpenAPI operation identified by\n``operationId: get_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to retrieve.\n\nReturns\n-------\nItem\n The requested item.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
},
"create_item": {
"name": "create_item",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.create_item",
"signature": "create_item(payload: ItemCreate, response: Response) -> Item",
"docstring": "Create a new item.\n\nImplements the OpenAPI operation identified by\n``operationId: create_item``.\n\nParameters\n----------\npayload : ItemCreate\n Request body describing the item to create.\nresponse : Response\n Response object used to set the HTTP status code.\n\nReturns\n-------\nItem\n The newly created item."
},
"update_item": {
"name": "update_item",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.update_item",
"signature": "update_item(item_id: int, payload: ItemCreate) -> Item",
"docstring": "Update an existing item.\n\nImplements the OpenAPI operation identified by\n``operationId: update_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to update.\npayload : ItemCreate\n New item data.\n\nReturns\n-------\nItem\n The updated item.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
},
"delete_item": {
"name": "delete_item",
"kind": "function",
"path": "openapi_first.templates.model_app.routes.delete_item",
"signature": "delete_item(item_id: int, response: Response) -> None",
"docstring": "Delete an existing item.\n\nImplements the OpenAPI operation identified by\n``operationId: delete_item``.\n\nParameters\n----------\nitem_id : int\n Identifier of the item to delete.\nresponse : Response\n Response object used to set the HTTP status code.\n\nReturns\n-------\nNone\n No content.\n\nRaises\n------\nHTTPException\n 404 if the item does not exist."
}
}
}
}

View File

@@ -0,0 +1,102 @@
{
"module": "openapi_first.templates.model_app.test_model_app",
"content": {
"path": "openapi_first.templates.model_app.test_model_app",
"docstring": "End-to-end tests for the OpenAPI-first model CRUD example app.\n\nThese tests validate that all CRUD operations behave correctly\nagainst the in-memory mock data store using Pydantic models.\n- OpenAPI specification loading\n- OperationId-driven route binding on the server\n- OperationId-driven client invocation\n- Pydantic model-based request and response handling\n\nAll CRUD operations are exercised against an in-memory mock data store\nbacked by Pydantic domain models.\n\nThe tests assume:\n- OpenAPI-first route binding\n- Pydantic model validation\n- In-memory storage (no persistence guarantees)\n- Deterministic behavior in a single process",
"objects": {
"load_openapi": {
"name": "load_openapi",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.load_openapi",
"signature": "load_openapi(path: str | Path)",
"docstring": "Load and validate an OpenAPI 3.x specification from disk.\n\nArgs:\n path (str | Path):\n Filesystem path to an OpenAPI specification file. Supported\n extensions: `.json`, `.yaml`, `.yml`.\n\nReturns:\n dict[str, Any]:\n Parsed and validated OpenAPI specification.\n\nRaises:\n OpenAPISpecLoadError:\n If the file does not exist, cannot be parsed, or fails OpenAPI\n schema validation.\n\nNotes:\n **Guarantees:**\n\n - The specification is parsed based on file extension and validated\n using a strict OpenAPI schema validator.\n - Any error results in an immediate exception, preventing\n application startup."
},
"OpenAPIClient": {
"name": "OpenAPIClient",
"kind": "class",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient",
"signature": "OpenAPIClient(spec: dict[str, Any], base_url: str | None = None, client: httpx.Client | None = None)",
"docstring": "OpenAPI-first HTTP client (`httpx`-based).\n\nArgs:\n spec (dict[str, Any]):\n Parsed OpenAPI 3.x specification.\n base_url (str | None):\n Base URL of the target service. If omitted, the first entry in the\n OpenAPI `servers` list is used.\n client (httpx.Client | None):\n Optional preconfigured httpx client instance.\n\nRaises:\n OpenAPIClientError:\n If no servers are defined, spec has no paths, operationIds are\n missing/duplicate, or required parameters are missing.\n\nNotes:\n **Responsibilities:**\n\n - This client derives all callable methods directly from an\n OpenAPI 3.x specification. Each `operationId` becomes a method\n on the client instance.\n\n **Guarantees:**\n\n - One callable per `operationId`.\n - Explicit parameters (path, query, headers, body).\n - No implicit schema inference or mutation.\n - Returns raw `httpx.Response` objects.\n - No response validation or deserialization.\n\nExample:\n ```python\n from openapi_first import loader, client\n\n spec = loader.load_openapi(\"openapi.yaml\")\n\n api = client.OpenAPIClient(\n spec=spec,\n base_url=\"http://localhost:8000\",\n )\n\n # Call operationId: getUser\n response = api.getUser(\n path_params={\"user_id\": 123}\n )\n\n print(response.status_code)\n print(response.json())\n ```",
"members": {
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient.spec",
"signature": null,
"docstring": null
},
"base_url": {
"name": "base_url",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient.base_url",
"signature": null,
"docstring": null
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient.client",
"signature": null,
"docstring": null
},
"operations": {
"name": "operations",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.OpenAPIClient.operations",
"signature": "operations()",
"docstring": null
}
}
},
"client": {
"name": "client",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.client",
"signature": null,
"docstring": null
},
"spec": {
"name": "spec",
"kind": "attribute",
"path": "openapi_first.templates.model_app.test_model_app.spec",
"signature": null,
"docstring": null
},
"test_list_items_initial": {
"name": "test_list_items_initial",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_list_items_initial",
"signature": "test_list_items_initial()",
"docstring": "Initial items should be present."
},
"test_get_item": {
"name": "test_get_item",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_get_item",
"signature": "test_get_item()",
"docstring": "Existing item should be retrievable by ID."
},
"test_create_item": {
"name": "test_create_item",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_create_item",
"signature": "test_create_item()",
"docstring": "Creating a new item should return the created entity."
},
"test_update_item": {
"name": "test_update_item",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_update_item",
"signature": "test_update_item()",
"docstring": "Updating an item should replace its values."
},
"test_delete_item": {
"name": "test_delete_item",
"kind": "function",
"path": "openapi_first.templates.model_app.test_model_app.test_delete_item",
"signature": "test_delete_item()",
"docstring": "Deleting an item should remove it from the store."
}
}
}
}

View File

@@ -0,0 +1,184 @@
{
"module": "openapi_first.templates.vet_app.data",
"content": {
"path": "openapi_first.templates.vet_app.data",
"docstring": "In-memory data store for the Veterinary Clinic example.\n\nThis module is NOT thread-safe and is intended for demos and scaffolds only.\n\nIt provides minimal, process-local data stores for the five veterinary\nclinic entities. Each store exposes standard CRUD operations backed by\na simple dictionary.\n\nThis module intentionally avoids:\n- persistence\n- concurrency guarantees\n- transactional semantics\n- validation beyond what Pydantic provides\n\nThis module is not part of the ``openapi_first`` library API surface.",
"objects": {
"list_parents": {
"name": "list_parents",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.list_parents",
"signature": "list_parents() -> list[Parent]",
"docstring": null
},
"get_parent": {
"name": "get_parent",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.get_parent",
"signature": "get_parent(parent_id: int) -> Parent",
"docstring": null
},
"create_parent": {
"name": "create_parent",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.create_parent",
"signature": "create_parent(payload: ParentCreate) -> Parent",
"docstring": null
},
"update_parent": {
"name": "update_parent",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.update_parent",
"signature": "update_parent(parent_id: int, payload: ParentCreate) -> Parent",
"docstring": null
},
"delete_parent": {
"name": "delete_parent",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.delete_parent",
"signature": "delete_parent(parent_id: int) -> None",
"docstring": null
},
"list_vets": {
"name": "list_vets",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.list_vets",
"signature": "list_vets() -> list[Vet]",
"docstring": null
},
"get_vet": {
"name": "get_vet",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.get_vet",
"signature": "get_vet(vet_id: int) -> Vet",
"docstring": null
},
"create_vet": {
"name": "create_vet",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.create_vet",
"signature": "create_vet(payload: VetCreate) -> Vet",
"docstring": null
},
"update_vet": {
"name": "update_vet",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.update_vet",
"signature": "update_vet(vet_id: int, payload: VetCreate) -> Vet",
"docstring": null
},
"delete_vet": {
"name": "delete_vet",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.delete_vet",
"signature": "delete_vet(vet_id: int) -> None",
"docstring": null
},
"list_treatments": {
"name": "list_treatments",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.list_treatments",
"signature": "list_treatments() -> list[Treatment]",
"docstring": null
},
"get_treatment": {
"name": "get_treatment",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.get_treatment",
"signature": "get_treatment(treatment_id: int) -> Treatment",
"docstring": null
},
"create_treatment": {
"name": "create_treatment",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.create_treatment",
"signature": "create_treatment(payload: TreatmentCreate) -> Treatment",
"docstring": null
},
"update_treatment": {
"name": "update_treatment",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.update_treatment",
"signature": "update_treatment(treatment_id: int, payload: TreatmentCreate) -> Treatment",
"docstring": null
},
"delete_treatment": {
"name": "delete_treatment",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.delete_treatment",
"signature": "delete_treatment(treatment_id: int) -> None",
"docstring": null
},
"list_pets": {
"name": "list_pets",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.list_pets",
"signature": "list_pets() -> list[Pet]",
"docstring": null
},
"get_pet": {
"name": "get_pet",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.get_pet",
"signature": "get_pet(pet_id: int) -> Pet",
"docstring": null
},
"create_pet": {
"name": "create_pet",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.create_pet",
"signature": "create_pet(payload: PetCreate) -> Pet",
"docstring": null
},
"update_pet": {
"name": "update_pet",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.update_pet",
"signature": "update_pet(pet_id: int, payload: PetCreate) -> Pet",
"docstring": null
},
"delete_pet": {
"name": "delete_pet",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.delete_pet",
"signature": "delete_pet(pet_id: int) -> None",
"docstring": null
},
"list_appointments": {
"name": "list_appointments",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.list_appointments",
"signature": "list_appointments() -> list[Appointment]",
"docstring": null
},
"get_appointment": {
"name": "get_appointment",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.get_appointment",
"signature": "get_appointment(appointment_id: int) -> Appointment",
"docstring": null
},
"create_appointment": {
"name": "create_appointment",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.create_appointment",
"signature": "create_appointment(payload: AppointmentCreate) -> Appointment",
"docstring": null
},
"update_appointment": {
"name": "update_appointment",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.update_appointment",
"signature": "update_appointment(appointment_id: int, payload: AppointmentCreate) -> Appointment",
"docstring": null
},
"delete_appointment": {
"name": "delete_appointment",
"kind": "function",
"path": "openapi_first.templates.vet_app.data.delete_appointment",
"signature": "delete_appointment(appointment_id: int) -> None",
"docstring": null
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,39 @@
{
"module": "openapi_first.templates.vet_app.main",
"content": {
"path": "openapi_first.templates.vet_app.main",
"docstring": "Application entry point for an OpenAPI-first Veterinary Clinic service.\n\nThis module constructs a FastAPI application exclusively from an\nOpenAPI specification and a handler namespace, without using\ndecorator-driven routing.\n\nAll HTTP routes, methods, request/response schemas, and operation\nbindings are defined in the OpenAPI document referenced by\n``openapi_path``. Python callables defined in the ``routes`` module are\nbound to OpenAPI operations strictly via ``operationId``.\n\nThis module contains no routing logic, persistence concerns, or\nframework configuration beyond application assembly.\n\nDesign guarantees:\n- OpenAPI is the single source of truth\n- No undocumented routes can exist\n- Every OpenAPI operationId must resolve to exactly one handler\n- All contract violations fail at application startup\n\nThis file is intended to be used as the ASGI entry point.\n\nExample:\n uvicorn main:app",
"objects": {
"OpenAPIFirstApp": {
"name": "OpenAPIFirstApp",
"kind": "class",
"path": "openapi_first.templates.vet_app.main.OpenAPIFirstApp",
"signature": "OpenAPIFirstApp(*, openapi_path: str, routes_module: Any, **fastapi_kwargs: Any)",
"docstring": "FastAPI application enforcing OpenAPI-first design.\n\nArgs:\n openapi_path (str):\n Filesystem path to the OpenAPI 3.x specification file. This\n specification is treated as the authoritative API contract.\n routes_module (ModuleType):\n Python module containing handler functions whose names correspond\n exactly to OpenAPI ``operationId`` values.\n **fastapi_kwargs (Any):\n Additional keyword arguments passed directly to\n ``fastapi.FastAPI`` (e.g., title, version, middleware, lifespan\n handlers).\n\nRaises:\n OpenAPIFirstError:\n If the OpenAPI specification is invalid, or if any declared\n ``operationId`` does not have a corresponding handler function.\n\nNotes:\n **Responsibilities:**\n\n - `OpenAPIFirstApp` subclasses `FastAPI` and replaces manual route\n registration with OpenAPI-driven binding.\n - All routes are derived from the provided OpenAPI specification,\n and each ``operationId`` is mapped to a Python function in the\n supplied routes module.\n - Auth dependencies are auto-injected from the spec's\n ``securitySchemes`` and per-operation ``security`` fields.\n\n **Guarantees:**\n\n - No route can exist without an OpenAPI declaration.\n - No OpenAPI operation can exist without a handler.\n - Swagger UI and ``/openapi.json`` always reflect the provided spec.\n - Handler functions remain framework-agnostic and testable.\n - Auth enforcement is driven entirely by the spec — no manual\n middleware or decorators required.\n\nExample:\n ```python\n from openapi_first.app import OpenAPIFirstApp\n import app.routes as routes\n\n app = OpenAPIFirstApp(\n openapi_path=\"app/openapi.json\",\n routes_module=routes,\n title=\"Example Service\",\n )\n ```",
"members": {
"openapi": {
"name": "openapi",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.main.OpenAPIFirstApp.openapi",
"signature": null,
"docstring": null
}
}
},
"lifespan": {
"name": "lifespan",
"kind": "function",
"path": "openapi_first.templates.vet_app.main.lifespan",
"signature": "lifespan(app)",
"docstring": null
},
"app": {
"name": "app",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.main.app",
"signature": null,
"docstring": null
}
}
}
}

View File

@@ -0,0 +1,639 @@
{
"module": "openapi_first.templates.vet_app.models",
"content": {
"path": "openapi_first.templates.vet_app.models",
"docstring": null,
"objects": {
"Metadata": {
"name": "Metadata",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.Metadata",
"signature": null,
"docstring": null,
"members": {
"createdOn": {
"name": "createdOn",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Metadata.createdOn",
"signature": null,
"docstring": null
},
"updatedOn": {
"name": "updatedOn",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Metadata.updatedOn",
"signature": null,
"docstring": null
}
}
},
"ParentBase": {
"name": "ParentBase",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.ParentBase",
"signature": null,
"docstring": null,
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.ParentBase.name",
"signature": null,
"docstring": null
},
"email": {
"name": "email",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.ParentBase.email",
"signature": null,
"docstring": null
},
"phone": {
"name": "phone",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.ParentBase.phone",
"signature": null,
"docstring": null
},
"metadata": {
"name": "metadata",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.ParentBase.metadata",
"signature": null,
"docstring": null
}
}
},
"ParentCreate": {
"name": "ParentCreate",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.ParentCreate",
"signature": null,
"docstring": null
},
"Parent": {
"name": "Parent",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.Parent",
"signature": null,
"docstring": null,
"members": {
"id": {
"name": "id",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Parent.id",
"signature": null,
"docstring": null
}
}
},
"VetBase": {
"name": "VetBase",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.VetBase",
"signature": null,
"docstring": null,
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.VetBase.name",
"signature": null,
"docstring": null
},
"specialty": {
"name": "specialty",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.VetBase.specialty",
"signature": null,
"docstring": null
},
"email": {
"name": "email",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.VetBase.email",
"signature": null,
"docstring": null
},
"phone": {
"name": "phone",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.VetBase.phone",
"signature": null,
"docstring": null
},
"metadata": {
"name": "metadata",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.VetBase.metadata",
"signature": null,
"docstring": null
}
}
},
"VetCreate": {
"name": "VetCreate",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.VetCreate",
"signature": null,
"docstring": null
},
"Vet": {
"name": "Vet",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.Vet",
"signature": null,
"docstring": null,
"members": {
"id": {
"name": "id",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Vet.id",
"signature": null,
"docstring": null
}
}
},
"ProcedureNoteBase": {
"name": "ProcedureNoteBase",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.ProcedureNoteBase",
"signature": null,
"docstring": null,
"members": {
"summary": {
"name": "summary",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.ProcedureNoteBase.summary",
"signature": null,
"docstring": null
},
"details": {
"name": "details",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.ProcedureNoteBase.details",
"signature": null,
"docstring": null
}
}
},
"BasicNote": {
"name": "BasicNote",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.BasicNote",
"signature": null,
"docstring": null,
"members": {
"noteType": {
"name": "noteType",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.BasicNote.noteType",
"signature": null,
"docstring": null
}
}
},
"HeartRateNote": {
"name": "HeartRateNote",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.HeartRateNote",
"signature": null,
"docstring": null,
"members": {
"noteType": {
"name": "noteType",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.HeartRateNote.noteType",
"signature": null,
"docstring": null
},
"bpm": {
"name": "bpm",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.HeartRateNote.bpm",
"signature": null,
"docstring": null
}
}
},
"DentalNote": {
"name": "DentalNote",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.DentalNote",
"signature": null,
"docstring": null,
"members": {
"noteType": {
"name": "noteType",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.DentalNote.noteType",
"signature": null,
"docstring": null
},
"procedureType": {
"name": "procedureType",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.DentalNote.procedureType",
"signature": null,
"docstring": null
},
"teeth": {
"name": "teeth",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.DentalNote.teeth",
"signature": null,
"docstring": null
}
}
},
"VaccineNote": {
"name": "VaccineNote",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.VaccineNote",
"signature": null,
"docstring": null,
"members": {
"noteType": {
"name": "noteType",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.VaccineNote.noteType",
"signature": null,
"docstring": null
},
"medicine": {
"name": "medicine",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.VaccineNote.medicine",
"signature": null,
"docstring": null
},
"leg": {
"name": "leg",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.VaccineNote.leg",
"signature": null,
"docstring": null
}
}
},
"PreOpNote": {
"name": "PreOpNote",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.PreOpNote",
"signature": null,
"docstring": null,
"members": {
"noteType": {
"name": "noteType",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PreOpNote.noteType",
"signature": null,
"docstring": null
},
"heartRate": {
"name": "heartRate",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PreOpNote.heartRate",
"signature": null,
"docstring": null
},
"temperature": {
"name": "temperature",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PreOpNote.temperature",
"signature": null,
"docstring": null
}
}
},
"SurgeryNote": {
"name": "SurgeryNote",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.SurgeryNote",
"signature": null,
"docstring": null,
"members": {
"noteType": {
"name": "noteType",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.SurgeryNote.noteType",
"signature": null,
"docstring": null
},
"surgeryType": {
"name": "surgeryType",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.SurgeryNote.surgeryType",
"signature": null,
"docstring": null
},
"complications": {
"name": "complications",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.SurgeryNote.complications",
"signature": null,
"docstring": null
}
}
},
"ProcedureNotes": {
"name": "ProcedureNotes",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.ProcedureNotes",
"signature": null,
"docstring": null
},
"Procedure": {
"name": "Procedure",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.Procedure",
"signature": null,
"docstring": null,
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Procedure.name",
"signature": null,
"docstring": null
},
"description": {
"name": "description",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Procedure.description",
"signature": null,
"docstring": null
},
"cost": {
"name": "cost",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Procedure.cost",
"signature": null,
"docstring": null
},
"notes": {
"name": "notes",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Procedure.notes",
"signature": null,
"docstring": null
}
}
},
"TreatmentBase": {
"name": "TreatmentBase",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.TreatmentBase",
"signature": null,
"docstring": null,
"members": {
"label": {
"name": "label",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.TreatmentBase.label",
"signature": null,
"docstring": null
},
"description": {
"name": "description",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.TreatmentBase.description",
"signature": null,
"docstring": null
},
"metadata": {
"name": "metadata",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.TreatmentBase.metadata",
"signature": null,
"docstring": null
}
}
},
"TreatmentCreate": {
"name": "TreatmentCreate",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.TreatmentCreate",
"signature": null,
"docstring": null
},
"Treatment": {
"name": "Treatment",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.Treatment",
"signature": null,
"docstring": null,
"members": {
"id": {
"name": "id",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Treatment.id",
"signature": null,
"docstring": null
}
}
},
"PetBase": {
"name": "PetBase",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.PetBase",
"signature": null,
"docstring": null,
"members": {
"name": {
"name": "name",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PetBase.name",
"signature": null,
"docstring": null
},
"species": {
"name": "species",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PetBase.species",
"signature": null,
"docstring": null
},
"age": {
"name": "age",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PetBase.age",
"signature": null,
"docstring": null
},
"weight": {
"name": "weight",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PetBase.weight",
"signature": null,
"docstring": null
},
"birthDate": {
"name": "birthDate",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PetBase.birthDate",
"signature": null,
"docstring": null
},
"photo": {
"name": "photo",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PetBase.photo",
"signature": null,
"docstring": null
},
"metadata": {
"name": "metadata",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PetBase.metadata",
"signature": null,
"docstring": null
}
}
},
"PetCreate": {
"name": "PetCreate",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.PetCreate",
"signature": null,
"docstring": null,
"members": {
"parent_ids": {
"name": "parent_ids",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.PetCreate.parent_ids",
"signature": null,
"docstring": null
}
}
},
"Pet": {
"name": "Pet",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.Pet",
"signature": null,
"docstring": null,
"members": {
"id": {
"name": "id",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Pet.id",
"signature": null,
"docstring": null
},
"parents": {
"name": "parents",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Pet.parents",
"signature": null,
"docstring": null
}
}
},
"AppointmentBase": {
"name": "AppointmentBase",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.AppointmentBase",
"signature": null,
"docstring": null,
"members": {
"date": {
"name": "date",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.AppointmentBase.date",
"signature": null,
"docstring": null
},
"notes": {
"name": "notes",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.AppointmentBase.notes",
"signature": null,
"docstring": null
},
"procedures": {
"name": "procedures",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.AppointmentBase.procedures",
"signature": null,
"docstring": null
},
"metadata": {
"name": "metadata",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.AppointmentBase.metadata",
"signature": null,
"docstring": null
}
}
},
"AppointmentCreate": {
"name": "AppointmentCreate",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.AppointmentCreate",
"signature": null,
"docstring": null,
"members": {
"pet_id": {
"name": "pet_id",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.AppointmentCreate.pet_id",
"signature": null,
"docstring": null
},
"vet_id": {
"name": "vet_id",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.AppointmentCreate.vet_id",
"signature": null,
"docstring": null
},
"treatment_id": {
"name": "treatment_id",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.AppointmentCreate.treatment_id",
"signature": null,
"docstring": null
}
}
},
"Appointment": {
"name": "Appointment",
"kind": "class",
"path": "openapi_first.templates.vet_app.models.Appointment",
"signature": null,
"docstring": null,
"members": {
"id": {
"name": "id",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Appointment.id",
"signature": null,
"docstring": null
},
"pet": {
"name": "pet",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Appointment.pet",
"signature": null,
"docstring": null
},
"vet": {
"name": "vet",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Appointment.vet",
"signature": null,
"docstring": null
},
"treatment": {
"name": "treatment",
"kind": "attribute",
"path": "openapi_first.templates.vet_app.models.Appointment.treatment",
"signature": null,
"docstring": null
}
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More