Ignore some fields in strict verification

Signed-off-by: Litchi Pi <litchi.pi@proton.me>
This commit is contained in:
Litchi Pi 2025-07-23 18:06:00 +02:00
commit d96393f9c9

View file

@ -36,6 +36,7 @@ from mealie.services.scraper import cleaner
from .template_service import TemplateService
POSSIBLE_NONE_FIELDS = [ "image" ]
class RecipeServiceBase(BaseService):
def __init__(self, repos: AllRepositories, user: PrivateUser, household: HouseholdInDB, translator: Translator):
@ -387,6 +388,9 @@ class RecipeService(RecipeServiceBase):
if strict:
for field in new_data.__class__.model_fields:
if field in POSSIBLE_NONE_FIELDS:
continue
if getattr(new_data, field) is None:
raise exceptions.IncompleteData(f"Incomplete recipe, missing {field}")