Skip to content

docs: PostGIS discovery & connect API endpoints (5 routes) completely missing from behaviors.md #375

Description

@evan-zhang11

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:

  1. discover-schemas{ schemas: [String] }
  2. discover-tables{ tables: [{ name, table_type }] } (requires schema param)
  3. discover-columns{ geometry_columns: [{ column_name, srid, geometry_type }], fid_candidates: [String] } (requires schema + table params)
  4. discover-objects{ objects: [{ schema, table, table_type, geometry_columns, existing_file_id, row_count }] }
  5. 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:

  1. connect or discover-objects → get overview of all available spatial data
  2. discover-schemas → pick a schema
  3. discover-tables → pick a table/view within that schema
  4. discover-columns → select geometry column and FID column
  5. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions