foca icon indicating copy to clipboard operation
foca copied to clipboard

build: add support for Connexion 3+

Open Rahuljagwani opened this issue 1 year ago • 3 comments

Description

I am making this PR to perform all checks on changes, although I have tested locally. I have made only the necessary changes. I will be writing a summary for the migration of connexion 2.14 to 3 and then request for reviews.

Fixes #188

Type of change

  • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Rahuljagwani avatar Feb 16 '24 20:02 Rahuljagwani

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (0d21a08) 100.00% compared to head (9662b33) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #204   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines          975       974    -1     
=========================================
- Hits           975       974    -1     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 16 '24 20:02 codecov[bot]

Apologies for the delay, @uniqueg.

Summary:

  • In connexion 2 we were using App which is of type Flask instance of connexion, while in connexion 3 they changed the type of App instance to FlaskApp which is their custom class.
  • Directly providing the configuration is not possible anymore (example- link). If you will try to provide any parameter to app.config following error will be thrown: AttributeError: 'FlaskApp' object has no attribute 'config'.
  • Installing connexion==3.0.1 did not work for me, I had to install connexion[flask] and connexion[uvicorn] to make it work, as connexion 3 is based on the ASGI server. (Throws: ModuleNotFoundError: Please install connexion using the 'flask' extra )
  • One minor change is that skip error handlers is also deprecated in connexion 3. (link)
  • I am not sure about how to configure parameters like host, port of a uvicorn app while initializing it (connexion 3 run), but I just stored them in app.app.config(link) and used them at runtime (link).
  • The major error I faced was that I was unable to add pet, TypeError: addPet() missing 1 required positional argument: 'pet', that's why I changed open-api spec, which is not ideal. (link)

I will keep adding new points whenever I will encounter some error.

Rahuljagwani avatar Feb 21 '24 19:02 Rahuljagwani

Closed in favor of #249

uniqueg avatar Jan 06 '25 15:01 uniqueg