Closed m4um4u1 closed 12 months ago
I forgot to add the error:
ValidationError: 2 validation errors for Recipe recipe_yield Field required [type=missing, input_value={'id': 'f1219ce4-7521-443...4326', 'lastMade': None}, input_type=dict] For further information visit https://errors.pydantic.dev/2.4/v/missing nutrition Field required [type=missing, input_value={'id': 'f1219ce4-7521-443...4326', 'lastMade': None}, input_type=dict] For further information visit https://errors.pydantic.dev/2.4/v/missing
Thanks for your report!
I have a little bit trouble to reproduce it, since I am not able to run mealie at the moment :). But it should be possible to only compare against the list of recipes from kptncook. I think we add a kptncook
tag for each recipe added by kptncook sync.
I'll look into this on the weekend, probably.
Sounds good, if you need help in any way, just let me know :)
The problem with my broken mealie instance is that the nuxt server process does not seem to forward requests to the fastapi python process. A request to my mealie instances api docs returns a 404 for example and I don't know why. Maybe some issue with the nuxt config, dunno.
Managed to work around this issue by forwarding the fastapi port to my local machine using ssh so I was still able to run kptncook sync
against it and immediately could reproduce your issue 😅.
Your issue seems to be caused by the pydantic2 upgrade from last month. In pydantic 1 foo: str | None
ment that the foo attribute is optional. In pydantic 2 it now means that it could be None, but is not optional. So I had replace those lines with foo: str | None = None
which means foo is optional in pydantic 2, too.
I also now skip recipes failing validation. I'm not really sure whether this is the right approach because now kptncook recipes might become re-added when they cannot be validated as mealie recipes. But just crashing is maybe also not the best approach.
Anyway - the issue from above should be fixed in 0.0.13
Thanks a lot for your hard work 😊
@ephes
Thanks for your tool 👍
In order for me to sync to Mealie today, I still need to put in a fix:
diff mealie.py.0.0.13 mealie.py
134c134
< file_name: str | None
---
> file_name: str | None = None
class RecipeAsset(BaseModel): name: str icon: str file_name: str | None = None
The script doesnt seem to like it when having recipies in mealie that are not from kptncook. We have a lot of recipies that we added manually or imported from url in our mealie. Is there a way to exclude them form the sync? Because the pydantic validator throws an exeption when theres missing variables like cookingTime or lastMade when syncing. Maybe we could give synced kptncook recepies a orgURL that we can parse in the script so it knows if its a syncable script or not