mxcube / mxcubeweb

MXCuBE-Web
http://mxcube.github.io/mxcubeweb/
GNU Lesser General Public License v3.0
21 stars 38 forks source link

Migrate from `spectree` to `FlaskOpenAPI3` #1407

Open marcus-oscarsson opened 12 hours ago

marcus-oscarsson commented 12 hours ago

We have so far been using spectree for generating the OpenApi/Swagger. documentation. There where not so many good alternatives when we selected this library but there is another one now called FlaskOpenAPI3.

FlaskOpenAPI3 seems to be overall more well maintained and supports Pydantic v2 without the use of the "compatibility" package pydantic.v1. The usage of FlaskOpenAPI3 is also a bit more straightforward, favoring type hinted methods instead of decorators. There is also more documentation UI options, which is not necessarily a big advantage but still nice.

We are so far not to a large extent using the explicit documentation/validation feature of spectree, instead mostly relying on the automatic route documentation. It would therefore be quite straight forward to migrate from spectree to FlaskOpenAPISpec. I can only count 7 explicit calls to the spectree validate function and those can easily be replaced.

What does the rest of you think, I can make the effort to migrate to FlaskOpenAPI3 if you think its a good idea ?

fabcor-maxiv commented 8 hours ago

I do not really use the OpenAPI page much (or not at all). Whether it is generated by one library or another does not matter much to me. As far as I understood switching to a different library should have no impact for the normal feature (i.e. non-developer features), so it seems safe to migrate.

I am a bit more worried about the migration to Pydantic v2 (but I have no idea about the potential impact of this migration).