-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The type_map parameter in PostGISDataSource (and the maps exported from the built-in datasources) is currently typed as dict[str, list[str]] | None. The keys are free-form strings, giving no editor support, no static guarantee that only known etter type names are used, and no shared contract that datasources can implement against.
Current situation
| Location | Current type |
|---|---|
PostGISDataSource.__init__ (postgis.py introduced in #25 ) |
dict[str, list[str]] | None |
SwissNames3DSource.OBJEKTART_TYPE_MAP (swissnames3d.py) |
dict[str, list[str]] |
IGNBDCartoSource.IGN_BDCARTO_TYPE_MAP (ign_bdcarto.py) |
dict[str, list[str]] |
The canonical set of normalized type names is defined in location_types.py
Problems
-
No static key validation. A caller can pass
{"lac": [...]}instead of{"lake": [...]}and the error only surfaces at runtime (silently: features are returned with the type"lac"instead of being filtered correctly). -
No IDE auto-complete. Because keys are
str, editors cannot suggest valid type names when constructing a custom map. -
No shared contract.
PostGISDataSourceaccepts the same shape as the built-in maps but there is no interface enforcing this, so future datasources can diverge. -
OBJEKTART_TYPE_MAP/IGN_BDCARTO_TYPE_MAPdo not declare intent. Their return typedict[str, list[str]]does not communicate that the keys must be etter type names.