From a7ea46cbfe64f0edb3ad5db035b655f955d0a11b Mon Sep 17 00:00:00 2001 From: Ian Stride Date: Tue, 15 Oct 2024 15:28:56 +0100 Subject: [PATCH] Upgrade to latest pydantic --- pyproject.toml | 3 ++- src/parenttext_goals_webhooks/main.py | 6 ++++-- tests/test_integrity.py | 2 -- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d10babe..0472623 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,8 @@ classifiers = [ ] dependencies = [ "fastapi~=0.110.0", - "pydantic~=1.10.14", + "pydantic", + "pydantic-settings", "rpft @ https://github.com/IDEMSInternational/rapidpro-flow-toolkit/archive/refs/heads/main.tar.gz", ] description = "Spreadsheet-backed API for ParentText goals" diff --git a/src/parenttext_goals_webhooks/main.py b/src/parenttext_goals_webhooks/main.py index ca1cb55..c40bfe2 100644 --- a/src/parenttext_goals_webhooks/main.py +++ b/src/parenttext_goals_webhooks/main.py @@ -4,7 +4,9 @@ from pathlib import Path from fastapi import FastAPI -from pydantic import BaseModel, BaseSettings +from pydantic import BaseModel +from pydantic_settings import BaseSettings + from parenttext_goals_webhooks import api_version from parenttext_goals_webhooks.hooks import Hooks @@ -79,7 +81,7 @@ class ListQuery(BaseModel): sort_columns: list[str] = list() class Config: - schema_extra = { + json_schema_extra = { "examples": [ { "filter_expression": "'no' in relationship", diff --git a/tests/test_integrity.py b/tests/test_integrity.py index 606ba80..c3b6b11 100644 --- a/tests/test_integrity.py +++ b/tests/test_integrity.py @@ -26,8 +26,6 @@ def test_module_IDs(self): self.assertTrue(hasattr(row, "topic_ID"), row) self.assertTrue(hasattr(row, "name"), row) self.assertIn(row.topic_ID, link_data, row) - # TODO: If we have a list of all modules in RapidPro, - # we can also check that the module ID is from that list def test_ltp_headers(self): data = self.db.ltp_activities()