Problem
The PostGIS registration workflow includes 5 API endpoints that are completely undocumented in docs/dev/behaviors.md:
Undocumented Endpoints
| # |
Endpoint |
Method |
Purpose |
| 1 |
/api/postgis/connections/discover-schemas |
POST |
List all user schemas in a PostGIS database |
| 2 |
/api/postgis/connections/discover-tables |
POST |
List tables/views in a specific schema |
| 3 |
/api/postgis/connections/discover-columns |
POST |
List geometry columns and FID candidates for a table |
| 4 |
/api/postgis/connections/discover-objects |
POST |
List ALL spatial objects across all user schemas |
| 5 |
/api/postgis/connections/connect |
POST |
Combined: test connection + discover spatial objects + check existing sources |
Implementation Details
All 5 endpoints are defined in backend/src/postgis.rs and registered in backend/src/routes.rs.
Common characteristics:
- All require authentication and admin role (
require_postgis_admin)
- Accept
PostgisConnectionConfig in the request body (host, port, database, username, password, sslMode)
sslMode=disable is the only supported value (MVP constraint)
Endpoint-specific responses:
- discover-schemas →
{ schemas: [String] }
- discover-tables →
{ tables: [{ name, table_type }] } (requires schema param)
- discover-columns →
{ geometry_columns: [{ column_name, srid, geometry_type }], fid_candidates: [String] } (requires schema + table params)
- discover-objects →
{ objects: [{ schema, table, table_type, geometry_columns, existing_file_id, row_count }] }
- connect →
{ success, server_version, postgis_version, objects: [...] } — similar to discover-objects but also returns version info and checks if objects are already registered as sources in the current workspace
Relationship Between Endpoints
The discover-* endpoints provide a granular, wizard-style registration flow:
- connect or discover-objects → get overview of all available spatial data
- discover-schemas → pick a schema
- discover-tables → pick a table/view within that schema
- discover-columns → select geometry column and FID column
- Finally, register (API-019) creates the data source
The connect endpoint appears to be a legacy/combined endpoint that overlaps with discover-objects but adds version info and existing-source lookup.
Current Documentation
Only these PostGIS endpoints are documented:
- API-018:
POST /api/postgis/connections/test (connection test only)
- API-019:
POST /api/postgis/sources/register (register a source)
The discovery workflow between test and register is completely undocumented.
Proposed Action
Add behavior contract entries (API-020a through API-020e, or a new module section) for the 5 discovery/connect endpoints. Each should document:
- Request body schema
- Response body schema
- Error responses (400 for connection failure, 401 for unauthenticated, 403 for non-admin)
- Expected status codes
Priority: P1 — These endpoints power the PostGIS registration wizard UI and should be documented as they represent significant user-facing functionality.
Problem
The PostGIS registration workflow includes 5 API endpoints that are completely undocumented in
docs/dev/behaviors.md:Undocumented Endpoints
/api/postgis/connections/discover-schemas/api/postgis/connections/discover-tables/api/postgis/connections/discover-columns/api/postgis/connections/discover-objects/api/postgis/connections/connectImplementation Details
All 5 endpoints are defined in
backend/src/postgis.rsand registered inbackend/src/routes.rs.Common characteristics:
require_postgis_admin)PostgisConnectionConfigin the request body (host, port, database, username, password, sslMode)sslMode=disableis the only supported value (MVP constraint)Endpoint-specific responses:
{ schemas: [String] }{ tables: [{ name, table_type }] }(requiresschemaparam){ geometry_columns: [{ column_name, srid, geometry_type }], fid_candidates: [String] }(requiresschema+tableparams){ objects: [{ schema, table, table_type, geometry_columns, existing_file_id, row_count }] }{ success, server_version, postgis_version, objects: [...] }— similar to discover-objects but also returns version info and checks if objects are already registered as sources in the current workspaceRelationship Between Endpoints
The
discover-*endpoints provide a granular, wizard-style registration flow:The
connectendpoint appears to be a legacy/combined endpoint that overlaps withdiscover-objectsbut adds version info and existing-source lookup.Current Documentation
Only these PostGIS endpoints are documented:
POST /api/postgis/connections/test(connection test only)POST /api/postgis/sources/register(register a source)The discovery workflow between test and register is completely undocumented.
Proposed Action
Add behavior contract entries (API-020a through API-020e, or a new module section) for the 5 discovery/connect endpoints. Each should document:
Priority: P1 — These endpoints power the PostGIS registration wizard UI and should be documented as they represent significant user-facing functionality.