Skip to content

Commit

Permalink
build: upgrade Pydantic to 2.7 (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
uniqueg authored May 20, 2024
1 parent f869937 commit 940408e
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 169 deletions.
2 changes: 1 addition & 1 deletion foca/api/register_openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def register_openapi(
spec.connexion = {} if spec.connexion is None else spec.connexion
app.add_api(
specification=spec_parsed,
**spec.dict().get('connexion', {}),
**spec.model_dump().get('connexion', {}),
)
logger.info(f"API endpoints added from spec: {spec.path_out}")

Expand Down
6 changes: 3 additions & 3 deletions foca/config/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ def __init__(
)
if format_logs:
self._configure_logging()
logger.debug(f"Parsed config: {self.config.dict(by_alias=True)}")
logger.debug(f"Parsed config: {self.config.model_dump(by_alias=True)}")

def _configure_logging(self) -> None:
"""Configure logging."""
try:
dictConfig(self.config.log.dict(by_alias=True))
dictConfig(self.config.log.model_dump(by_alias=True))
except Exception as e:
dictConfig(LogConfig().dict(by_alias=True))
dictConfig(LogConfig().model_dump(by_alias=True))
logger.warning(
f"Failed to configure logging. Falling back to default "
f"settings. Original error: {type(e).__name__}: {e}"
Expand Down
Loading

0 comments on commit 940408e

Please sign in to comment.