Connexion 2.0 (#619)

- App and Api options must be provided through the "options" argument (``old_style_options`` have been removed).
- You must specify a form content-type in 'consumes' in order to consume form data.
- The `Operation` interface has been formalized in the `AbstractOperation` class.
- The `Operation` class has been renamed to `Swagger2Operation`.
- Array parameter deserialization now follows the Swagger 2.0 spec more closely.
  In situations when a query parameter is passed multiple times, and the collectionFormat is either csv or pipes, the right-most value will be used.
  For example, `?q=1,2,3&q=4,5,6` will result in `q = [4, 5, 6]`.
  The old behavior is available by setting the collectionFormat to `multi`, or by importing `decorators.uri_parsing.AlwaysMultiURIParser` and passing `parser_class=AlwaysMultiURIParser` to your Api.
- The spec validator library has changed from `swagger-spec-validator` to `openapi-spec-validator`.
- Errors that previously raised `SwaggerValidationError` now raise the `InvalidSpecification` exception.
  All spec validation errors should be wrapped with `InvalidSpecification`.
- Support for nullable/x-nullable, readOnly and writeOnly/x-writeOnly has been added to the standard json schema validator.
- Custom validators can now be specified on api level (instead of app level).
- Added support for basic authentication and apikey authentication
- If unsupported security requirements are defined or ``x-tokenInfoFunc``/``x-tokenInfoUrl`` is missing, connexion now denies requests instead of allowing access without security-check.
- Accessing ``connexion.request.user`` / ``flask.request.user`` is no longer supported, use ``connexion.context['user']`` instead
This commit is contained in:
João Santos
2018-11-05 14:50:42 +01:00
committed by GitHub
parent 08faf2aa86
commit 44ea9336fe
160 changed files with 4561 additions and 39687 deletions

View File

@@ -36,10 +36,12 @@ def expected_arguments():
Default values arguments used to call `connexion.App` by cli.
"""
return {
"swagger_json": True,
"swagger_ui": True,
"swagger_path": None,
"swagger_url": None,
"options": {
"swagger_json": True,
"swagger_ui": True,
"swagger_path": None,
"swagger_url": None,
},
"auth_all_paths": False,
"debug": False
}
@@ -100,7 +102,7 @@ def test_run_using_option_hide_spec(mock_app_run, expected_arguments,
runner.invoke(main, ['run', spec_file, '--hide-spec'],
catch_exceptions=False)
expected_arguments['swagger_json'] = False
expected_arguments['options']['swagger_json'] = False
mock_app_run.assert_called_with('connexion.cli', **expected_arguments)
@@ -110,7 +112,7 @@ def test_run_using_option_hide_console_ui(mock_app_run, expected_arguments,
runner.invoke(main, ['run', spec_file, '--hide-console-ui'],
catch_exceptions=False)
expected_arguments['swagger_ui'] = False
expected_arguments['options']['swagger_ui'] = False
mock_app_run.assert_called_with('connexion.cli', **expected_arguments)
@@ -121,7 +123,7 @@ def test_run_using_option_console_ui_from(mock_app_run, expected_arguments,
runner.invoke(main, ['run', spec_file, '--console-ui-from', user_path],
catch_exceptions=False)
expected_arguments['swagger_path'] = user_path
expected_arguments['options']['swagger_path'] = user_path
mock_app_run.assert_called_with('connexion.cli', **expected_arguments)
@@ -132,7 +134,7 @@ def test_run_using_option_console_ui_url(mock_app_run, expected_arguments,
runner.invoke(main, ['run', spec_file, '--console-ui-url', user_url],
catch_exceptions=False)
expected_arguments['swagger_url'] = user_url
expected_arguments['options']['swagger_url'] = user_url
mock_app_run.assert_called_with('connexion.cli', **expected_arguments)