Nullable Episode.audio_preview_url #305
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pydantic throws a
ValidationError
when an episode with theaudio_preview_url
field set to none is returned by the Spotify API. That is because theEpisode
base class currently expectsstr
instead ofOptional[str]
for this attribute.The Spotify API documentation declares the field as a nullable string.
I successfully tested the change using the following minimal example.
I'm not sure whether or not it would be appropriate to add a check for this change, but I did not create one. It feels wrong to use hard-coded episode IDs in a check since the episodes could change or be taken down in the future...
The existent checks seem to pass just fine, though i've never worked with tox before and might have overlooked something.
Related issue: I did not create one
tox
checks passed with an appropriately configuredenvironment
PS: This is my first proper pull request, so let me know about anything I can improve :)