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

Escaped API response causes pydantic max_length validation to fail #96

Open
ilaskaev opened this issue Dec 15, 2023 · 3 comments
Open
Labels
triage This will looked at

Comments

@ilaskaev
Copy link

ilaskaev commented Dec 15, 2023

  • lunchable version: 0.9.0
  • Python version: 3.11

Description

Lunchmoney API (/v1/categories/group/{category_id}/add in this case) sometimes seems to send back some escaped characters (eg. / instead of /), which results in pydantic max_length validations to sometimes fail as string length is not counted correctly.

image

Imo this is probably a bug on the lunchmoney API side though

What I Did

  1. Create a new category that is of 40 characters long and add it to a category group
  2. Add a new category in same category group with insert_into_category_group method
  3. Error will be raised as the children[] will fail instantiation due to having a length > 40 characters.
@github-actions github-actions bot added the triage This will looked at label Dec 15, 2023
@juftin
Copy link
Owner

juftin commented Dec 15, 2023

Hey @ilaskaev thanks for reporting 🙇 . That's a bummer, I'll look at only validating for 40 characters on the create / update side instead of the read side.

There are a number of big changes coming, including Pydantic v2 - I should be able to get this resolved in the next few days hopefully.

@juftin
Copy link
Owner

juftin commented Dec 22, 2023

This is a bug being tracked here https://feedback.lunchmoney.app/bugs/p/unescape-category-names-in-api-response

FYI @ilaskaev - are you okay with waiting for that to be resolved or would you like a resolution in lunchable?

@ilaskaev
Copy link
Author

Yep not a problem, I monkey patched the issue from my side to make things work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage This will looked at
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants