Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider using swagger for API self-description #28

Open
mydatascience opened this issue May 10, 2020 · 2 comments
Open

Consider using swagger for API self-description #28

mydatascience opened this issue May 10, 2020 · 2 comments

Comments

@mydatascience
Copy link
Contributor

It will be great if a user can use the nice web-API via swagger-UI for the ADAM controller. Makes it much easier to use, especially remotely. Go-Swagger module https://github.com/go-swagger/go-swagger

@rvs
Copy link
Contributor

rvs commented May 10, 2020

Adam implements two sets of API end points:

  1. EVE controller APIs https://github.com/lf-edge/eve/blob/master/api/API.md
  2. Adam admin APIs

Given that №1 is all in proto definitions I can see us generating swagger specs by simply running protoc --swagger_out=... AND we potentially can express №2 in proto as well (although I don't know if @deitch will look at it is more of an overkill).

Then, I suppose, it is simply a question of https://goswagger.io/usage/serve_ui.html

@deitch
Copy link
Contributor

deitch commented May 11, 2020

Yes, I think this is a good idea. Honestly, my biggest beef with swagger has always been the overhead. You have to have structs you can annotate, which now means maintaining it both in the main location where the routes actually are implemented, in this case here, and in the docs dir or wherever you annotate them. That means you're actually defined in two places, and is guaranteed to get out of sync.

That doesn't mean it isn't the "right thing to do" (it might be), just that it is a pain to do once, and a pain to maintain. We now need to move from the simple handler above to something much more complex.

Is it worth it? If so, I am more than happy to take a PR for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants