feat(api): define public problem errors, pagination, and retry contract

This commit is contained in:
shira committed 2026-10-05 22:09:36 +03:00
1 parent b2f6e87bfe
commit 565ca94bbb
86 files changed
+8200 -154

No files matched your search

+11 -5
View File
@@ -1,7 +1,7 @@
.DEFAULT_GOAL := help
UV ?= uv
API_PREPARED ?= 0
.PHONY: help install generate check-generated build run fmt fmt-check lint lint-fix typecheck test test-contract check verify
.PHONY: help install generate check-generated check-pydantic-compat build run fmt fmt-check lint lint-fix typecheck test test-contract check verify
help: ## Show available ML service commands.
@awk 'BEGIN {FS = ":.*## "} /^[a-zA-Z0-9_-]+:.*## / {printf "%-14s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@@ -16,6 +16,12 @@ generate: ## Generate Pydantic models from the shared ML contract.
check-generated: ## Check Pydantic models against the bundled contract without rewriting them.
cd codegen && $(UV) run --project .. datamodel-codegen --check
check-pydantic-compat: ## Generate Pydantic models from the OpenAPI 3.2 compatibility fixture into a temporary directory and check them.
@temporary_dir=$$(mktemp -d) && trap 'rm -rf "$$temporary_dir"' EXIT && \
(cd codegen && $(UV) run --project .. datamodel-codegen --input ../../api/testdata/openapi-3.2.0.yml --output "$$temporary_dir/fixture_models.py" --openapi-scopes schemas parameters paths) && \
$(UV) run mypy --strict "$$temporary_dir/fixture_models.py" && \
$(UV) run python scripts/check_fixture_models.py "$$temporary_dir/fixture_models.py"
build: ## Build the service wheel.
$(UV) build
@@ -23,16 +29,16 @@ run: ## Run the operational API on port 8000.
$(UV) run uvicorn lincodex_ml.main:app --host 0.0.0.0 --port 8000
fmt: ## Format Python source.
$(UV) run ruff format src tests
$(UV) run ruff format src tests scripts
fmt-check: ## Check Python formatting.
$(UV) run ruff format --check src tests
$(UV) run ruff format --check src tests scripts
lint: ## Run Ruff checks.
$(UV) run ruff check src tests
$(UV) run ruff check src tests scripts
lint-fix: ## Apply safe Ruff fixes.
$(UV) run ruff check --fix src tests
$(UV) run ruff check --fix src tests scripts
typecheck: ## Run strict mypy checks.
$(UV) run mypy src