Skip to content

Commit c654b4c

Browse files
authored
fix: use replace deprecated custom json serialization with default pydantic v2 model_config (#501)
## Issue #474 ## What? removes the json_loads and json_dumps parameters from the ConfigDict and uses default model_config ## Why? it is no longer supported by Pydantic V2
2 parents 3aa94a1 + a7503dd commit c654b4c

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

stac_api/runtime/src/render.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,7 @@
33
from typing import Any, Dict, List, Optional
44
from urllib.parse import urlencode
55

6-
import orjson
7-
from pydantic import BaseModel, ConfigDict
8-
9-
10-
def orjson_dumps(v: Dict[str, Any], *args: Any, default: Any) -> str:
11-
"""orjson.dumps returns bytes, to match standard json.dumps we need to decode."""
12-
return orjson.dumps(v, default=default).decode()
6+
from pydantic import BaseModel
137

148

159
def get_param_str(params: Dict[str, Any]) -> str:
@@ -53,8 +47,6 @@ def get_render_params(self) -> str:
5347
params = self.render_params.copy()
5448
return f"{get_param_str(params)}"
5549

56-
model_config = ConfigDict(json_loads=orjson.loads, json_dumps=orjson_dumps)
57-
5850

5951
def get_render_config(render_params) -> RenderConfig:
6052
"""This is a placeholder for what may be a more complex function in the future.

0 commit comments

Comments
 (0)