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

Fix @returns.json support for casting response using provided type #229

Merged
merged 4 commits into from
Jan 8, 2022

Conversation

prkumar
Copy link
Owner

@prkumar prkumar commented Aug 1, 2021

Fix @returns.json to cast JSON response (or field referenced by the key argument) using the type argument when the given type is callable. This restores behavior that was inadvertently changed in v0.9.3.

Example:

  @uplink.returns.from_json(key=("data", 0, "size"), type=int)
  @uplink.get("/users/{user}/repos")
  def get_first_repo_size(self, user):
      pass
assert github.get_first_repo_size("prkumar") == 300

#215

@codecov
Copy link

codecov bot commented Aug 1, 2021

Codecov Report

Merging #229 (15cd1e8) into master (17a6283) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #229   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           44        44           
  Lines         2466      2475    +9     
  Branches       355       358    +3     
=========================================
+ Hits          2466      2475    +9     
Impacted Files Coverage Δ
uplink/returns.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17a6283...15cd1e8. Read the comment docs.

@prkumar prkumar force-pushed the feature/v0.9.5/fix-@returns.json branch from 27bac1e to 2f26971 Compare January 8, 2022 01:40
@prkumar prkumar changed the title Add @returns.json support for casting response to built-in type Fix @returns.json support for casting response using provided type Jan 8, 2022
@prkumar prkumar merged commit 3472806 into master Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant