-
Notifications
You must be signed in to change notification settings - Fork 62
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 *args **kwargs to built in converters (e.g. pydantic by_alias) #225
Comments
I just hit this too it seems like uplink does not call uplink/uplink/converters/pydantic_.py Line 12 in d3ee283
and in pydantic that method doesn't pass thru kwargs to return obj.dict() |
I'm looking into different approaches for how we can address this. The approach I'm favoring presently is to define a new decorator (e.g., @json
@returns.json
@converters.pydantic.dict(by_alias=True)
@post("scenario")
def create(self, payload: Body(type=Case)):
pass Passing args through |
As long as the Update: Here is my homework 🙈 pydantic/pydantic#565 |
@jkornblum edit: Ah, nevermind. I was missing the |
Is your feature request related to a problem? Please describe.
Pydantic is supported out of the box but I can't use it to serialize when using field aliases.
Pydantic has support for this but I don't see a way to pass this information in Uplink.
Say I have a pydantic model like the following. The API uses camelcase but Python api should use snake case.
In Uplink I have
The
GET
works based on thealias_generator
in model but thePOST
does not work (does not convert snake to camel case) because one needs to passby_alias
argument to the.json()
method on Pydantic model class [doc]Describe the solution you'd like
I'd like to be able to pass *args and **kwargs to the converters that are built in. API something like
For now my work-around is just to use custom serialization function.
Cheers - Josh
The text was updated successfully, but these errors were encountered: