Releases: giswater/api
Releases · giswater/api
Release list
v1.5.0
What's Changed
Added
- Service layer (
app/services/): business logic extracted from FastAPI routes into HTTP-agnostic services (ServiceContext, domain services for basic/CRM/OM/EPA/routing/system/admin). HTTP handlers and the CLI share the same code path. giswater-apiCLI (app/cli/, Click): console script entry point afterpip install -e .. Commands:admin tenants list|get— platform tenant registryadmin users list|create— gwapi user management (basic-auth tenants)tenant --tenant … --schema … ready— tenant readiness probe (exit code 1 when not ready)tenant … crm insert-hydrometer— example tenant-scoped CRM operation- Global
--tenants-diroverridesTENANTS_DIRoutside the FastAPI lifespan
app/api/exception_handlers.py: centralized mapping of service-layer exceptions to HTTP responses (replaces per-route error handling).docs/ARCHITECTURE.md(package map, dependency rules, where to add code) anddocs/VERSIONING.md(API/DB versioning policy).- CLI smoke test (
tests/test_cli_smoke.py).
Changed
- FastAPI-aligned internal layout (no HTTP path, env var, or behavior changes).
app/is now split into standard subpackages:app/api/—deps.py(wasdependencies.py),v1/(router.pywiring +endpoints/tenant routers), andadmin/(tenants.py,users.py,router.py).app/core/—config.py,constants.py,exceptions.py(dependency-free leaf).AUTH_MODES/DEPRECATED_KEYCLOAK_ENABLED_ISSUEnow live incore/config.py, fixing a latentconfig<=>authimport cycle.app/auth/—session.py(wasauth.py),keycloak.py,users.py(wasgwapi_users.py),schemas.py(ApiUser+ gwapi user DTOs),constants.py.app/db/—manager.py(wasdatabase.py),context.py,execution.py,version.py,log_store.py, andbootstrap/{log,gwapi}.py(the oldapp/schemas.pyDDL).app/tenancy/—registry.py(wastenant.py),state.py,host_middleware.py.app/middleware/request_logging.py(wasapp/logging.py, no longer shadows stdliblogging).app/schemas/now holds all Pydantic request/response models (wasapp/models/).app/utils/slimmed into focused modules:body.py,version.py(mergesgiswater_version.py),rate_limit.py,plugins.py,log_setup.py,routing.py.
- All v1 and admin route handlers are now thin wrappers:
CommonsDep→get_service_context()→ service method → JSON response. - OpenAPI
descriptionmetadata added or improved across admin, system, and tenant endpoints. - README updated with CLI usage examples and the new package layout.
Fixed
- Service-layer exceptions are re-raised after handling so FastAPI's registered exception handlers produce the correct HTTP status and body (instead of being swallowed or mapped inline in routes).
Removed
app/api/http_errors.py(superseded byexception_handlers.py).
Pull Requests
Full Changelog: v1.4.0...v1.5.0
v1.4.0
What's Changed
Added
- Per-tenant
AUTH_MODE(none|basic|keycloak) for tenant API authentication. basicmode: HTTP Basic auth backed by thegwapischema (gwapi.users, roles, user CRUD via admin API).- Unified
ApiUseridentity withrequire_role()FastAPI dependency. app/schemas.pycentralizes DDL bootstrap forlogandgwapischemas.- Install script for production deployment (single-tenant)
Deprecated
KEYCLOAK_ENABLEDper-tenant env var (shim maps toAUTH_MODE; removal in 2.0.0,# DEPRECATED #22).- Admin API top-level
keycloakblock (useauth.mode+auth.keycloak).
Pull Requests
Full Changelog: v1.3.2...v1.4.0
v1.3.2
What's Changed?
Fixed
- Sector and expl ID fields are lists of integers
Full Changelog: v1.3.1...v1.3.2
v1.3.1
What's Changed?
Fixed
- Skip DB logging for tenant health probes (
${API_ROOT}/v1/health), matching global and admin health.
Full Changelog: v1.3.0...v1.3.1
v1.3.0
What's Changed?
Added
LOG_DB_RESPONSE_MAX_BYTES(default8192): truncate the raw DB function payload stored inlog.gw_api_logs_db.response_json(captured byexecute_procedure). Prevents huge JSON responses from bloating the API DB log table. Set to0to disable truncation. Independent fromLOG_DB_MAX_BODY_BYTES, which only caps HTTP request/response bodies inlog.gw_api_logs.
Full Changelog: v1.2.0...v1.3.0
v1.2.0
What's changed?
Added
- Single-tenant routing mode (
SINGLE_TENANT_ID): when set, all${API_ROOT}/v1/*requests resolve to that tenant regardless ofHost, and${API_ROOT}/admin/*is reachable on the same host/IP. Enables IP-only or single-host production deployments without DNS or fakeHostheaders.BASE_DOMAINis ignored for routing in this mode. When unset, DNS-based multi-tenant routing viaBASE_DOMAINis unchanged.
Changed
- Configurable API root: all surfaces now live under a single env-driven prefix (
API_ROOT, default/giswater). Tenant API at${API_ROOT}/v1, admin at${API_ROOT}/admin, global health at${API_ROOT}/health, static at${API_ROOT}/static. SetAPI_ROOT=/gw-apito keep legacy v1.1 URLs. - Log viewer (
/logs/ui) now resolves its static asset URLs fromSTATIC_PREFIXinstead of hardcoded/gw-api/static. deploy/nginx.conf.example,scripts/smoke_test.sh, anddocker-compose.ymlhealthcheck updated to use${API_ROOT}(default/giswater).- Public URLs moved from
/gw-api/...to/giswater/...by default. Deployments that need the old paths must setAPI_ROOT=/gw-api; clients, Keycloak callbacks, probes, and any hardcoded URLs must be updated accordingly.
Full Changelog: v1.1.0...v1.2.0
v1.1.0
v1.0.0
What's Changed
Added
- Production runtime:
gunicorn+uvicorn.workers.UvicornWorkerwithgunicorn.conf.py(workers fromWEB_CONCURRENCY, timeouts, max-requests). - Logging defaults:
LOG_HTTP_BODY_CAPTUREdefault on (bodies truncated viaLOG_DB_MAX_BODY_BYTES);LOG_DB_SAMPLE_RATEdefault 1.0 for full request audit; response buffering only when capture enabled. - DB compatibility gate:
GISWATER_DB_VERSION_CHECK/GISWATER_DB_MIN_VERSIONintegrated into tenantGET /gw-api/v1/ready. - Golden prod env:
.env.prod.example; deployment checklistdocs/DEPLOYMENT_CHECKLIST.md. - Post-deploy smoke:
scripts/smoke_test.sh; pytest operability smoke (tests/test_operability.py). - Version parsing helper:
app/giswater_version.py.
Changed
- Dockerfile CMD uses Gunicorn instead of bare
uvicorn. - Hot paths: narrower
psycopg.Errorhandling in DB/SQL utilities and admin log queries; routing/Valhalla helpers avoid bareexcept. - Documentation: README deployment, compatibility table for 1.x, logging and probe guidance.
Security
- Payload retention is truncated and skippable: set
LOG_HTTP_BODY_CAPTURE=falsefor metadata-only, or lowerLOG_DB_SAMPLE_RATEif the DB log table is under pressure.
Removed
- Runtime
print(...)usage in favor of structured logging.
Pull requests
- chore(deps): bump cryptography from 46.0.5 to 46.0.7 by @dependabot[bot] in #19
- refactor: implement multi-tenancy by @smaspons in #20
- Make the app release-ready by @smaspons in #21
Full Changelog: v0.9.0...v1.0.0
v0.9.0
What's Changed
Added
- Keycloak admin client id
- Add execute upsert on utils and new upsert endpoint for dscenario objects
Full Changelog: v0.8.3...v0.9.0
v0.8.2
What's Changed
Changed
- Dscenario object_id management & various fixes
- App icon
Full Changelog: v0.8.1...v0.8.2