diff --git a/CHANGES.md b/CHANGES.md index 8abb5b6e..8105c079 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,9 @@ # Release Notes +## 1.3.1 (2024-06-21) + +* update models to avoid pydantic deprecation + ## 1.3.0 (2024-05-17) * update titiler requirement to `>=0.18.0,<0.19` diff --git a/docs/src/advanced/custom_search.md b/docs/src/advanced/custom_search.md index 675b9d07..707b3885 100644 --- a/docs/src/advanced/custom_search.md +++ b/docs/src/advanced/custom_search.md @@ -55,7 +55,7 @@ def search_factory(request: Request, body: RegisterMosaic) -> Tuple[PgSTACSearch scheme, token = get_authorization_scheme_param(authorization) payload = jwt.decode(token, algorithms=["HS256"], key="your-256-bit-secret") - search = body.dict(exclude_none=True, exclude={"metadata"}, by_alias=True) + search = body.model_dump(exclude_none=True, exclude={"metadata"}, by_alias=True) search["filter"] = { "op": "and", "args": [ diff --git a/docs/src/notebooks/demo.ipynb b/docs/src/notebooks/demo.ipynb index a860392f..e861e3bb 100644 --- a/docs/src/notebooks/demo.ipynb +++ b/docs/src/notebooks/demo.ipynb @@ -166,7 +166,7 @@ "bounds = (-87.0251, 36.0999, -85.4249, 36.2251)\n", "\n", "poly = Polygon.from_bounds(*bounds)\n", - "geojson = Feature(type=\"Feature\", geometry=poly, properties=None).dict(exclude_none=True)\n", + "geojson = Feature(type=\"Feature\", geometry=poly, properties=None).model_dump(exclude_none=True)\n", "\n", "m = Map(\n", " tiles=\"OpenStreetMap\",\n", @@ -648,7 +648,7 @@ " attr=\"Mosaic\",\n", " min_zoom=tj_response[\"minzoom\"],\n", " max_zoom=tj_response[\"maxzoom\"],\n", - " max_native_zoom=tj_response[\"maxzoom\"], \n", + " max_native_zoom=tj_response[\"maxzoom\"],\n", ")\n", "aod_layer.add_to(m)\n", "m" diff --git a/titiler/pgstac/model.py b/titiler/pgstac/model.py index 910a22db..32ab23a6 100644 --- a/titiler/pgstac/model.py +++ b/titiler/pgstac/model.py @@ -224,20 +224,27 @@ class Link(BaseModel): str, Field( description="Supplies the URI to a remote resource (or resource fragment).", - example="http://data.example.com/buildings/123", + json_schema_extra={ + "example": ["http://data.example.com/buildings/123"], + }, ), ] rel: Annotated[ str, Field( - description="The type or semantics of the relation.", example="alternate" + description="The type or semantics of the relation.", + json_schema_extra={ + "example": ["alternate"], + }, ), ] type: Annotated[ Optional[MediaType], Field( description="A hint indicating what the media type of the result of dereferencing the link should be.", - example="application/geo+json", + json_schema_extra={ + "example": ["application/geo+json"], + }, ), ] = None templated: Annotated[ @@ -248,21 +255,27 @@ class Link(BaseModel): Optional[str], Field( description="A base path to retrieve semantic information about the variables used in URL template.", - example="/ogcapi/vars/", + json_schema_extra={ + "example": ["/ogcapi/vars/"], + }, ), ] = None hreflang: Annotated[ Optional[str], Field( description="A hint indicating what the language of the result of dereferencing the link should be.", - example="en", + json_schema_extra={ + "example": ["en"], + }, ), ] = None title: Annotated[ Optional[str], Field( description="Used to label the destination of a link such that it can be used as a human-readable identifier.", - example="Trierer Strasse 70, 53115 Bonn", + json_schema_extra={ + "example": ["Trierer Strasse 70, 53115 Bonn"], + }, ), ] = None length: Optional[int] = None