-
Notifications
You must be signed in to change notification settings - Fork 930
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
Auto-generated API documentation #7874
Comments
Could I be assigned this issue? |
yep, done! |
@WilliamGrossKC Do you still intend to work on this or should we un-assign so someone else can have a go at it? |
Hi,
I am very sorry. I recently experienced a death in the family and had to file for an incomplete for the class I was contributing to this GitHub for. I do not think I will be able to finish the assigned issue. I’m very sorry for the inconvenience.
…Sent from my iPhone
On Jan 18, 2021, at 7:53 PM, Stéphane Graber ***@***.***> wrote:
@WilliamGrossKC Do you still intend to work on this or should we un-assign so someone else can have a go at it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Sorry for your loss, I'll unassign this from you. |
Two points: First, based on some initial experimentation I feel that using swaggo requires a lot of refactoring.
has to be refactored to:
This is not difficult or challenging, but I guess this touches a lot of code. Is this suitable and ok with you? Second, my intention is to use the swagger/OpenAPI description to code-generate a corresponding API client. I have manually written an OpenAPI spec and observed that the LXD API is incompatible with OpenAPI on some endpoints resp. in some design aspects. For example: This problem shows at various points, for example also when receiving responses of variable schema. Is there any chance to resolve this? A reasonable solution might be to add additional (redundant) endpoints with suitably defined request/response structures (and maybe deprecating old ones). Let's discuss. |
On our side, the main goal right now is to replace I've been looking at some options today, most swaggo and go-swagger but also some of the OpenAPI 3.0 options. I'm currently just trying to have the YAML and then web rendering of As for your question, I'm currently not intending to make any API changes or additions with this, purely document what's there. |
Current preview: https://dl.stgraber.org/swag-lxd/ |
@stgraber looks good! |
|
Closes #7874 Signed-off-by: Stéphane Graber <[email protected]>
Over the years, we've certainly hit the limits of
doc/rest-api.md
as a suitable way to describe our API and its valid input/output.Advanced users know to go look at
shared/api
to find everything that's possible for every endpoint but this is far from ideal.I'd like us to switch over to auto-generated API documentation.
Looking around, I've found https://github.com/swaggo/swag which seems to fit the bill and in theory should just work with our existing functions and structs.
For this issue, we should pick a somewhat standard REST API endpoint, let's say
/1.0/instances/NAME/exec
and annotate it so that everything that's supported by that endpoint is covered. We can then review the resulting API documentation and if we find it suitable, can keep going with the rest of the endpoints.If this works out, we'd ultimately generate
doc/rest-api.md
from the swagger spec and use it to render a nice interactive doc for our API.The text was updated successfully, but these errors were encountered: