Skip to content

Remove non-existent recipeSlug field from RecipeRating - #814

Merged
andrew-codechimp merged 1 commit into
joostlek:mainfrom
domodom30:remove-recipe-slug
Aug 6, 2026
Merged

andrew-codechimp merged 1 commit into
joostlek:mainfrom
domodom30:remove-recipe-slug

Conversation

@domodom30

@domodom30 domodom30 commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Proposed Changes

RecipeRating declares a recipe_slug attribute mapped to the recipeSlug alias, but the Mealie API never returns such a field, so the attribute was always None.

Checking the openapi.json vendored in this repository:

  • GET /api/users/self/favorites and GET /api/users/self/ratings return
    UserRatings[UserRatingSummary], and UserRatingSummary only defines recipeId,
    rating and isFavorite.
  • GET /api/users/{id}/favorites and GET /api/users/{id}/ratings return
    UserRatings[UserRatingOut], which adds userId and id — still no slug.

The field was introduced in #738 (my own PR), so this is a follow-up fix on my side.

This PR:

  • removes recipe_slug from RecipeRating;
  • removes the recipeSlug keys from tests/fixtures/recipe_favorites.json, so the
    fixture matches a real API response;
  • updates the test_get_recipe_favorites snapshot accordingly.

RecipeRating is part of the public API (exported from aiomealie/__init__.py), so strictly speaking this removes a public attribute. Since it could only ever be None, no caller can meaningfully depend on its value. Callers that need a slug are unaffected: add_recipe_favorite, remove_recipe_favorite and rate_recipe already take the slug as an argument, and it can be resolved from recipe_id through the recipe endpoints.

The Mealie API never returns this field: GET /api/users/self/favorites
responds with UserRatings[UserRatingSummary], whose items only expose
recipeId, rating and isFavorite. The attribute was therefore always None.

Update the test fixture and snapshot to match the real API response.
@andrew-codechimp andrew-codechimp added the bugfix Inconsistencies or issues which will cause a problem for users or implementers. label Aug 5, 2026

@andrew-codechimp andrew-codechimp left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed this field does not exist.
This is only used within the get_recipe_favorites method which is new and has not been used within Home Assistant Mealie integration yet.

@domodom30

domodom30 commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks @andrew-codechimp
I realized my mistake late.

@andrew-codechimp
andrew-codechimp merged commit 40d8cb8 into joostlek:main Aug 6, 2026
12 of 13 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bugfix Inconsistencies or issues which will cause a problem for users or implementers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants