Skip to content

Commit

Permalink
Merge pull request #164 from stac-utils/patch/update-pydantic-Fields
Browse files Browse the repository at this point in the history
update pydantic Field to avoid deprecation
  • Loading branch information
vincentsarago authored Jul 17, 2024
2 parents 21ffe58 + 0e0f785 commit e47cf6d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release Notes

## Unreleased

* update models to avoid pydantic deprecation

## 1.3.0 (2024-05-17)

* update titiler requirement to `>=0.18.0,<0.19`
Expand Down
2 changes: 1 addition & 1 deletion docs/src/advanced/custom_search.md
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
4 changes: 2 additions & 2 deletions docs/src/notebooks/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down
25 changes: 19 additions & 6 deletions titiler/pgstac/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[
Expand All @@ -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
Expand Down

0 comments on commit e47cf6d

Please sign in to comment.