Open akhundMurad opened 2 years ago
So it's saying PostService
has no methods with @validate
. Can you show the PostService class?
İt is because of PostService class is not Pydantic model. PostService class is just simple object with crud
I recently started getting this erorr RuntimeError: no validator found for <class 'models.client.Client'>, see arbitrary_types_allowed in Config
as well. Did something in pydantic
or flask_pydantic
change? The following code used to work just fine:
from flask_pydantic import validate
@blueprint.route("/clone", subdomain="<subdomain>", methods=["POST"])
@inject_client()
@validate()
def clone_client_endpoint(
body: ClientCloneReq, # A Pydantic model
client: Client, # not a Pydantic model, comes from @inject_client()
**kwargs
):
I think this issue not only about Python Dependency Injection Framework. This error appears when we use not Pydantic models in annotations
I think this issue not only about Python Dependency Injection Framework. This error appears when we use not Pydantic models in annotations
Yeah, just weird that this is broken now. Definitely worked before we upgraded from 0.4 to 0.9.
I had the same issue and did a little investigation. The problem seems to be with validate_path_params method in validate decorator. That was introduced in 0.7.0 version, so it tell why David didn't have the issue with version 0.4.0. The issue is, it takes path parameters from the method arguments instead of route as it should.
Hi! I am using this module with Python Dependency Injection Framework and when i try to use Provider in kwargs of the view i am getting:
RuntimeError: no validator found for <class '...'>, see arbitrary_types_allowed in Config
Reason of this error is the fact that @validate decorator ignores only kwargs named as "query", "body", "return". It would be better if @validate decorator ignored kwargs which default is Provide instanceSample code: