Closed WilliamChen-luckbob closed 8 months ago
Validation is not enabled by default.
You either need to specify it in the expect call like @ns.expect(todo, validate=True)
or set global configuration flag RESTX_VALIDATE
.
Does that fix your issue?
Validation is not enabled by default.
You either need to specify it in the expect call like
@ns.expect(todo, validate=True)
or set global configuration flagRESTX_VALIDATE
.Does that fix your issue?
Problem solved, thanks a lot!
I don't find any similar issues.
Code
here is the code copied from quick start, and I tried to add 'test' as an extra parameter into
todo
. The full runnable code is showing below:Repro Steps (if applicable)
just run it and try the put request from the swagger ui to see what happen if the required param is missing
![image](https://github.com/python-restx/flask-restx/assets/58684828/7c14a3f4-7c86-421f-bfcf-a0bad35ceaf1)
the validation is not working, when
test
ortask
is missing in request body, I can still get a succeed response.Expected Behavior
throw any exceptions like parameter is missing
Actual Behavior
just let request pass.
Error Messages/Stack Trace
Nothing happened, and no error was found, the validation just not working.
Environment
I'm new to python, for testing the validation situation, I just begin with quick start and installed flask and flask-restx only in an new and individual venv I don't know if the python version is too high to use such function and lead to some problem