-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Create model using a function signature #1391
Comments
I've realized there is a validate_arguments method, I'm closing this issue. |
validate_arguments serve a different use case. Personally I don't understand why not going forward with the original idea... |
This is a great idea @antoniomdk , though I agree with @danielbraun89 , I'm trying to build an automated function signature to base model to fastAPI request body and would need to extract the base model from function signatures. validate_arguments doesn't actually provide the base model it uses internally it appears, unless I've missed something. |
NVM, I just noticed: I can use this as the model, didn't see it in the documentation, LMK if putting in a PR in for the docs if useful. |
This model type uses a Pydantic model to validate function arguments and return values, exposing functions to pass in and retrieve arguments, and to call functions using the stored arguments. This is a feature that has been asked for previously in pydantic#1391 but which was possible through v1 methods which are not present in v2.
This model type uses a Pydantic model to validate function arguments and return values, exposing functions to pass in and retrieve arguments, and to call functions using the stored arguments. This is a feature that has been asked for previously in pydantic#1391 but which was possible through v1 methods which are not present in v2 and so that issue is already closed.
This model type uses a Pydantic model to validate function arguments and return values, exposing functions to pass in and retrieve arguments, and to call functions using the stored arguments. This is a feature that has been asked for previously in pydantic#1391 but which was possible through v1 methods which are not present in v2 and so that issue is already closed.
This model type uses a Pydantic model to validate function arguments and return values, exposing functions to pass in and retrieve arguments, and to call functions using the stored arguments. This is a feature that has been asked for previously in pydantic#1391 but which was possible through v1 methods which are not present in v2 and so that issue is already closed.
This model type uses a Pydantic model to validate function arguments and return values, exposing functions to pass in and retrieve arguments, and to call functions using the stored arguments. This is a feature that has been asked for previously in pydantic#1391 but which was possible through v1 methods which are not present in v2 and so that issue is already closed.
Feature Request
Hi everyone, first things first, thank you for this fantastic tool you're developing.
I think it would be interesting to create a model dynamically based on a function signature.
In my case, I have some kind of function runners: functions that receive a function and
call it adding decorators, etc. I've created the following snippet to create a model from
a function signature. If you're interested in this feature, I can create a PR for it.
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:Example
The text was updated successfully, but these errors were encountered: