Repository navigation
fix(templates): add version fields to the template type - #323
Open
mayankbohradev wants to merge 1 commit into
Open
mayankbohradev wants to merge 1 commit into
mayankbohradev wants to merge 1 commit into
Conversation
The retrieve template response contains `current_version_id` and `has_unpublished_versions`. The SDK already returns them, but the `Template` type did not declare them, so mypy reported a documented key lookup as an error. - Add `current_version_id` and `has_unpublished_versions` to `Template`. Tested with tox lint, mypy and py (868 passed).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Adds
current_version_idandhas_unpublished_versionsto theTemplatetype.Why
The retrieve template response contains both fields, and the SDK already returns them. The type did not declare them, so mypy reported
template["has_unpublished_versions"]as an error.How
NotRequired, like the other optionalTemplatefields, so code that builds aTemplatedict still type-checks.TemplateListItemis unchanged, because the list response does not contain these fields.Testing
tox -e lint,tox -e mypyandtox -e pypass (868 tests).Notes for reviewers
#321 and #322 also change
resend/version.py; I can rebase whichever merges later.Summary by cubic
Adds
current_version_idandhas_unpublished_versionsto theTemplatetype so code reading the documented retrieve template response type-checks under mypy.NotRequired, matching the other optionalTemplatefields, soTemplatedict literals still type-check.TemplateListItemstays unchanged since the list response doesn't include these fields.2.54.1and adds sync and async tests covering both fields.Written for commit e6e88a1. Summary will update on new commits.