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

Avoid false positive deprecation warning #1550

Closed
wants to merge 20 commits into from
Closed

Avoid false positive deprecation warning #1550

wants to merge 20 commits into from

Conversation

lanzkron
Copy link
Contributor

@lanzkron lanzkron commented Jun 9, 2022

Fixes # .

Do not warn about the schema's x-body-name being deprecated unless it is being used.

Changes proposed in this pull request:

  • Code behaviour is unchanged, if body name is set use it, otherwise fallback to the schema's (deprecated) name or "body" if nothing is set
  • If x-body-name is set in the schema, warn about deprecation and use (unless overridden by the request body).

RobbeSneyders and others added 17 commits March 22, 2022 22:26
* Add Python 3.10 in favor of 3.6

* Increase lower bound requests for Python 3.10 compatibility
* Add empty connexion middleware

* Address PR comments

* Bump minimum Flask version to 2

* Update tests for changed werkzeug behavior in 2.1

pallets/werkzeug#2352
* Extract swagger UI functionality from AbstractAPI

* Extract Swagger UI functionality into middleware

Co-authored-by: Wojciech Paciorek <arkkors@users.noreply.github.com>

* Add additional docstrings

Co-authored-by: Wojciech Paciorek <arkkors@users.noreply.github.com>
* Add routing middleware

Factor out starlette BaseHTTPMiddleware

Fix exceptions for starlette < 0.19

Fix docstring formatting

Rename middleware/base.py to abstract.py

Rework routing middleware

* Clean up abstract API docstrings

* Move connexion context into extensions

* Allow empty middleware list
* Extract security to middleware

* Add MissingMiddleware exception

* Extract add_auth_on_not_found in security middleware

* Add detail kwarg to exceptions

* Return JSONResponse in ExceptionMiddleware

* Type dicts in SecurityMiddleware

* Add trailing comma in setup.py

* Rework connexion context

* Improve error handling for missing security operation

* Refactor default security operation

* Revert "Return JSONResponse in ExceptionMiddleware"

This reverts commit c1004c7.

* Move routing context name into constant
* Fix uri parsing for query parameter with empty brackets (#1501)

* Update tests for changed werkzeug behavior in 2.1 (#1506)

pallets/werkzeug#2352

* Bugfix/async security check (#1512)

* Add failing tests

* Use for else construct

* openapi: remove JSON body second validation and type casting (#1170)

* openapi: remove body preprocessing

Body is already validated using jsonschema. There was also some type
casting but it was wrong: e.g. not recurring deeply into dicts and lists,
relying on existence of "type" in schema (which is not there e.g. if
oneOf is used). Anyway, the only reason why types should be casted is
converting integer values to float if the type is number. But this is in
most cases irrelevant.

Added an example, which did not work before this commit (echoed `{}`)
e.g. for
```
curl localhost:8080/api/foo -H 'content-type: application/json' -d
'{"foo": 1}'
```
but now the example works (echoes `{"foo": 1}`).

* test with oneOf in the requestBody

* remove oneof examples: superseded by tests

Co-authored-by: Pavol Vargovcik <pavol.vargovcik@kiwi.com>

Co-authored-by: Ruwann <ruwanlambrichts@gmail.com>
Co-authored-by: Pavol Vargovčík <pavol.vargovcik@gmail.com>
Co-authored-by: Pavol Vargovcik <pavol.vargovcik@kiwi.com>
* Fix deprecation warning for iter_errors
Bump jsonschema version to at least v4

* Bump jsonschema to v4.0.1

* Provide schema as keyword arg to evolve

* Fix evolve statement
* Rename MiddlewareAPI to RoutingAPI

* Refactor routing into middleware-api-operation model
* Removed jsonschema version check

* Remove dependency on importlib-metadata

* Remove packaging dependency
* Remove check for uwsgi metrics

* Removing uwsgi metrics and corresponding test files
* Fix for bug of the function is_json_mimetype() (#1114)

* Splitting the mimetype correctly

* Added a test for the json mimetype usecases

* Update connexion/utils.py

Co-authored-by: Ruwann <ruwan.lambrichts@ml6.eu>
Only warn about the schema's `x-body-name` being deprecated if it's used.
@RobbeSneyders
Copy link
Member

Hi @lanzkron.
Thanks for the PR, but this was already fixed on the v2 branch (#1521) and we'll cherry pick this to main. It hasn't been released yet, but I'll prepare a new release now.

@RobbeSneyders
Copy link
Member

Actually, the fix I mentioned just moves the issue.

@RobbeSneyders RobbeSneyders reopened this Jun 10, 2022
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2477548682

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.342%

Totals Coverage Status
Change from base Build 2416536603: 0.0%
Covered Lines: 2651
Relevant Lines: 2810

💛 - Coveralls

@RobbeSneyders RobbeSneyders changed the base branch from main to v2 June 10, 2022 22:04
@RobbeSneyders
Copy link
Member

@lanzkron I changed the target branch to v2. Could you remove the commits from main and rebase on v2?

@lanzkron
Copy link
Contributor Author

I seem to have messed up the rebase. I'll close this PR and create a clean one on v2.
BTW the reason #1550 didn't work was because the second get gave a default "body" so it was never None.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants