mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-10 04:19:37 +00:00
* Added MethodViewResolver By subclassing RestyResolver and modifying its `resolve_function_from_operation_id` method, it is now possible to use automatic routing functionality with Flask's MethodView together with MethodViewResolver. * Add MethodView example * Add tests for methodview * add documentation on how to use MethodViewResolver
18 lines
549 B
Python
Executable File
18 lines
549 B
Python
Executable File
#!/usr/bin/env python
|
|
import logging
|
|
|
|
import connexion
|
|
from connexion.resolver import MethodViewResolver
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
|
|
if __name__ == '__main__':
|
|
app = connexion.FlaskApp(__name__, specification_dir='openapi/', debug=True)
|
|
|
|
options = {"swagger_ui": True}
|
|
app.add_api('pets-api.yaml',
|
|
options=options,
|
|
arguments={'title': 'MethodViewResolver Example'},
|
|
resolver=MethodViewResolver('api'), strict_validation=True, validate_responses=True )
|
|
app.run(port=9090)
|