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
ValidationError when requesting a playlist containing an episode #310
Comments
Hi and thank you for submitting the issue! We've made some related changes recently, so please let me know if upgrading Tekore helps. But if it doesn't I'll see what this is about! And to be fair, I saw something similar in our daily test run, so it might be a recent change. The validation error is misleading because the type is a union (of track and episode) so Pydantic just spits out everything even though it might be really close to one of them. |
Hi, I discovered the bug on the current version 5.2.1. Thank you for your help! This is such an awesome library 👏 |
Thank you 🙏 one thing would help a lot still: could you upgrade Pydantic too? In our tests I see that Show publisher has an object inside rather than the string advertised in the docs and the OpenAPI spec, and |
Yep, my pydantic version was quite outdated. I upgraded to pydantic 2.5.2 and pydantic-core 2.14.5. I get a more verbose traceback now. The
To be fair though, pydantic still complains about seemingly every field. In case it helps; the full traceback is appended, with only errors for the
|
Thank you! The episode model has also been updated to have restrictions and to deprecate |
And apparently markets in the playlist episode version :P and also local track duration_ms is an object. Maybe they're having a bad week over there 😅 |
I cannot successfully run the test suite locally either due to unrelated errors. So I'll just release this along with other minor stuff. Merry Christmas! |
Sounds good to me! I'll probably work with the library in the next few days, so I'll see if anything is broken :D |
Issue
When requesting a playlist containing a show (podcast) episode, pydantic throws 10 ValidationErrors indicating that required fields are missing or containing the wrong values.
When I request the same playlist using the spotify developer portal directly, all fields seem to be present.
Looking at the traceback below, the error
pydantic_core._pydantic_core.ValidationError: 10 validation errors for FullPlaylistTrack
indicates that a FullPlaylistTrack instead of a FullPlaylistEpisode was recognized, which is most likely why the data can't be validated properly.Unfortunately I can't seem to find where/how you determine what type of track should be validated, so I couldn't create a PR to fix it directly.
Expected behavior
spotify.playlist()
should try to validate episodes in thetracks
field asFullPlaylistEpisode
instead ofFullPlaylistTrack
Steps to reproduce
Use
spotify.playlist()
to request a playlist containing at least track one of typeepisode
. I used this playlist for testing.Minimal Working Example:
The text was updated successfully, but these errors were encountered: