Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nightly] - Meal Plan Notes allow Submission Without Title/Note Text, but Return 422 #2446

Open
5 tasks done
Grygon opened this issue Jul 7, 2023 · 7 comments · May be fixed by #4615
Open
5 tasks done

[nightly] - Meal Plan Notes allow Submission Without Title/Note Text, but Return 422 #2446

Grygon opened this issue Jul 7, 2023 · 7 comments · May be fixed by #4615

Comments

@Grygon
Copy link
Contributor

Grygon commented Jul 7, 2023

First Check

  • This is not a feature request
  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.

What is the issue you are experiencing?

image

image

image

Planning to handle in #2399 but submitting since it may be a little while before I get to it.

Deployment

Docker (Linux)

Deployment Details

No response

@michael-genson
Copy link
Collaborator

Ah I see, looks like we need to add validation to the frontend. This is the backend:

class CreatePlanEntry(MealieModel):
    date: date
    entry_type: PlanEntryType = PlanEntryType.breakfast
    title: str = ""
    text: str = ""
    recipe_id: UUID | None

    @validator("recipe_id", always=True)
    @classmethod
    def id_or_title(cls, value, values):
        if bool(value) is False and bool(values["title"]) is False:
            raise ValueError(f"`recipe_id={value}` or `title={values['title']}` must be provided")

        return value

@Grygon
Copy link
Contributor Author

Grygon commented Jul 12, 2023

Fixed by 776d56e

@boc-the-git
Copy link
Collaborator

Adding bug confirmed, based on Michael's comment way back when.

@dzek69
Copy link

dzek69 commented Mar 11, 2024

Bump. Can we get this fix implemented?

It seems that the fix is not a part of this repo, but it's ready to use (idk Vue, but looks correct), so it's probably a quick upgrade that fixes pretty annoying bug 👍🏻

@boc-the-git
Copy link
Collaborator

I've just tested the solution posted here and it doesn't seem to work for me - the UI tells me the field is required but doesn't actually stop me submitting it and hitting the 422 error.
I'm not going to dig into it any more right now.

@20kaushik02
Copy link

Getting the same error even on 1.12.0

@Arshad561
Copy link

Arshad561 commented Nov 26, 2024

Hi @boc-the-git, I have fixed this issue in this PR
#4615

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants