Skip to content
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

path arguments of type number can't accept integers #1041

Closed
logi opened this issue Sep 18, 2019 · 1 comment · Fixed by #1306
Closed

path arguments of type number can't accept integers #1041

logi opened this issue Sep 18, 2019 · 1 comment · Fixed by #1306
Labels
Milestone

Comments

@logi
Copy link
Contributor

logi commented Sep 18, 2019

The Swagger and OpenAPI specs don't say anything about arguments of type number being restricted to non-integer values. However, passing an integer in for a number or integer variable results in a 404 Not Found.

This seems to be behaviour inherited from Flask's int and float converters which they inherited from Werkzeug and reading their code, they still validate agains regex = r"\d+\.\d+"

This is the less tractable sister of #1040 since it requires the introduction of a flag in Werkzeug's FloatConverter class to relax the regular expression above.

@logi
Copy link
Contributor Author

logi commented Sep 18, 2019

As @davidism points out in pallets/werkzeug#1645 one can make a custom converter such as number which will accept numbers without a decimal point and so this could be done completely in the connexion codebase.

@dtkav dtkav added the bug label Nov 10, 2019
logi added a commit to Belgingur/connexion that referenced this issue Oct 16, 2020
These don't try to enforce a "single representation" of paths but instead try to convert the numbers that callers pass in.

Addresses spec-first#1040 and spec-first#1041
logi added a commit to Belgingur/connexion that referenced this issue Jul 14, 2021
These don't try to enforce a "single representation" of paths but instead try to convert the numbers that callers pass in.

Addresses spec-first#1040 and spec-first#1041
logi added a commit to Belgingur/connexion that referenced this issue Jul 14, 2021
These don't try to enforce a "single representation" of paths but instead try to convert the numbers that callers pass in.

Addresses spec-first#1040 and spec-first#1041
@hjacobs hjacobs added this to the 2.9 milestone Jul 14, 2021
hjacobs pushed a commit that referenced this issue Jul 14, 2021
* Use more liberal flask converters for float and int

These don't try to enforce a "single representation" of paths but instead try to convert the numbers that callers pass in.

Addresses #1040 and #1041

* Use f-strings instead of string concat or %-formats

* Complying with style rules added long after this PR was made
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants