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

support passing pydantic original model as request body #209

Merged
merged 2 commits into from
Nov 22, 2020

Conversation

lust4life
Copy link
Contributor

Changes proposed in this pull request:

  • support passing pydantic original model as request body
from pydantic import BaseModel
from uplink import Consumer, Body

class CreateRepo(BaseModel):
   name: str
   delete_branch_on_merge: bool = False

class GitHub(Consumer):
   @post("user/repos")
   def create_repo(self, repo: Body(type=CreateRepo)):
      """Creates a new repository for the authenticated user."""


github = GitHub(base_url="https://api.github.com")
repo = CreateRepo(name="my_favorite_new_project")
github.create_repo(repo)  # instead of github.create_repo(repo.dict())

Attention: @prkumar

@codecov
Copy link

codecov bot commented Nov 3, 2020

Codecov Report

Merging #209 (44d7dcc) into master (0a4c072) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #209   +/-   ##
=======================================
  Coverage   99.91%   99.91%           
=======================================
  Files          44       44           
  Lines        2399     2401    +2     
  Branches      179      180    +1     
=======================================
+ Hits         2397     2399    +2     
  Misses          2        2           
Impacted Files Coverage Δ
uplink/converters/pydantic_.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 0a4c072...44d7dcc. Read the comment docs.

@prkumar prkumar merged commit 47715bc into prkumar:master Nov 22, 2020
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.

2 participants