developmentseed / tipg

Simple and Fast Geospatial OGC Features and Tiles API for PostGIS.
https://developmentseed.org/tipg/
MIT License
149 stars 21 forks source link

Error reading table config properties #154

Closed vidhav closed 8 months ago

vidhav commented 8 months ago

When I try to pass a list of properties in my configuration:

TABLE_CONFIG__public_mytable__PROPERTIES=["name","type","status"]

I get the following error from Pydantic:

table_config.public_mytable.properties
  Input should be a valid list [type=list_type, input_value='["name","type","status"]', input_type=str]

I believe this is because Pydantic settings only parses JSON in the top-level (as stated in the docs):

JSON is only parsed in top-level fields, if you need to parse JSON in sub-models, you will need to implement validators on those models.

In this case, the values are nested and validated with a TypedDict (see the code). For this to work, the code may need to be refactored to be BaseSettings with a custom validator to handle the parsing...