-
Notifications
You must be signed in to change notification settings - Fork 35
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
Supports both string, int, and HTTPStatus #86
Comments
I see. I do not see the battle of string vs int as intrinsically important one but what I consider important is using HTTPStatus as that's built-in and RFC-compliant. And it uses ints. So we can just cast to string every time the library's methods need a string. It would be one "less thing" to maintain in case they change the definitions in a future Python release. This way we get the value, the phrase and a description for free. So I strongly believe it should be implemented. That's a very good point on the HTTPMethod. It was selfish of me to not check when that was implemented. Apologies. We would need to invalidate way too many Python versions because of a couple of strings. That one is not worth it in my opinion. What do you think? |
I got it!
What I mean is that we cannot give up supporting |
I see, my apologies it seems there are miscommunications between us. Reading ints is also faster than a string alone, so "Small" performance improvement at no cost. |
Why did you use a custom library of strings instead of the official HTTPStatus lib built-in in Python everywhere?
flask_openapi3/http.py vs from http import HTTPStatus
There's inconsistencies vs HTTP Status as a string and HTTP Status as an int.
There's also from http import HTTPMethod for methods.
@CostcoFanboy We are here to discuss this issue.
At the beginning of the project, it was completely based on the OpenAPI Specification, so only the
string
was considered.However, I am open to both
int
andHTTPStatus
, and we can support both.HTTPMethod was not supported until Python 3.11.
The text was updated successfully, but these errors were encountered: