-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
[BUG] [flask-python] Optional date in query parameters results in dateutil error when None #5813
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Tested it locally by modifying util.mustache like above and using that one as the template. This seems to fix the issue. Will see later today if I can checkout the project and contribute a fix. |
As "deserialize_date" and "deserialize_datetime" are used outside of "deserialize_model", we should check 'None' value before parsing string.
Closed via #10081. Thanks for the PR by @LeComptoirDesPharmacies |
This bug affects python-aiohttp, as well. Fix was only applied to python-flask |
Bug Report Checklist
4.3.0
Description
I've recently extended my api with a query parameter of type string, format date. The parameter is optional. If the client does not fill in the parameter, it is None on the Python side, resulting in a parse error in dateutil:
openapi-generator version
4.3.0
OpenAPI declaration file content or url
Command line used for generation
openapi-generator generate -i ./api/openapi.yaml -g python-flask -o ./server/generated/ -c ./server/codegen/config.json
Steps to reproduce
Related issues/PRs
Couldn't find a related issue.
Suggest a fix
It should either be fixed in util.mustache by adding a check for the date being not None and otherwise returning None. Or something similar in controller.mustache.
Same goes for datetime I guess, but haven't tested that.
The text was updated successfully, but these errors were encountered: