Open traviscook21 opened 3 years ago
I wonder if the validate option is only for request validation and not for response validation.
I'm just confirming what I believe is the same problem. I get an error with Pydantic 1.8.2
:
"3valid": (pydantic.fields.ModelField.validate,),
TypeError: One of the targeted functions for key "3valid" is not a function
Edit: Ah-ha.
In[1]: type(pydantic.fields.ModelField.validate)
Out[1]: cython_function_or_method
inspect.isfunction()
will therefore not recognize pydantic.fields.ModelField.validate
.
I have forked this repository to implement a fix.
IIUC, this issue is same as #3. Please do not hesitate to open a PR against yappi as well. I will happily merge.
Thank you!
In the README, it says to use
fastapi.routing.ModelField.validate
in order to profile how long it takes to validate the response.No matter which function calls I ask it to profile I'm able to get yappi to return a profile for the
3valid
step.I can confirm by entering a debugger that these functions are being called, it's just that
yappi
isn't profiling them. I'm not entirely sure why.I know you haven't looked in this in a while and you did so much research. to get this working in the first place. It's greatly appreciated!
Here's a repro:
And here's the result from hitting
localhost:8000/