ihatemoney icon indicating copy to clipboard operation
ihatemoney copied to clipboard

Created OpenAPI specification

Open autumnull opened this issue 2 years ago • 4 comments

The specification can be viewed in the editor at https://editor.swagger.io/

I have done my best to make the specification compliant with the actual behavior of the api, testing using the ihatemoney.org instance.

This specification can also be used to generate better documentation in the readthedocs.io page, like this: https://docs.gotosocial.org/en/latest/api/swagger/

autumnull avatar Jul 17 '22 13:07 autumnull

Thanks for this hard work. Did you do this manually? In this case: well done! The OpenAPI/Swagger definition is not really a goal for IHateMoney itself, but it's very important nonetheless because of the ecosystem (Cospend/MoneyBuster/PayForMe). So I'll be delighted to integrate this work. However, I have a question. How to ensure that API spec is up to date with the code? I've done some search about existing libraries that generate OpenAPI definitions:

  • https://github.com/flasgger/flasgger Seems old, but example with Flask-RESTful. Need YAML in docstring
  • https://github.com/marshmallow-code/flask-smorest Lightweight and maintained. Need marshmallow definitions as code
  • https://github.com/luolingchun/flask-openapi3 Maintained but replace Flask-RESTful, but with support for Blueprints.
  • https://github.com/jmcarp/flask-apispec Lightweight and somewhat maintained. Need marshmallow code, but using decorators
  • https://github.com/danleonard-nj/swagger-gen Very young, but work with "simple" decorator.

Do you have any experience/opinion on these?

Glandos avatar Jul 17 '22 15:07 Glandos

I wrote this specification manually based on the REST API specification on the readthedocs page, and the behavior of the instance hosted at ihatemoney.org.

Unfortunately I have no experience/opinion on those libraries. It does seem like a good idea to keep the spec up to date with the code though, and manually rewriting the spec every time would be a chore. Hopefully this initial contribution will help get the ball rolling on that.

autumnull avatar Jul 17 '22 16:07 autumnull

@autumnull did you have any reason to delete your fork? If it is just based on our slow reaction time, it's sad, but don't worry, we won't throw your work away!

Glandos avatar Aug 28 '22 08:08 Glandos

Oh woops I actually completely forgot why I had a fork of this repo so i just deleted it while i was cleaning up my repositories -- entirely an accident! Hope the file changes are still useful :heart:

autumnull avatar Aug 29 '22 22:08 autumnull

Hi, I'm not sure what to do with this. It seems that it would be better to use an automated generation of the API rather than having this done manually. If so, we should probably close this and lead to using one of these libraries.

Would that be okay for you?

almet avatar Dec 10 '22 17:12 almet

yep no worries :)

autumnull avatar Dec 11 '22 22:12 autumnull