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
[openapi] API definition using Open API v3 #122
Conversation
Added Directory API documentation in OpenAPI, but response schemas are still missing.
I've read up on the OpenAPI initiative, and it looks quite interesting. Are you creating the definition with a specific client / use case in mind? How is one supposed to publish this definition? |
Hi Stefan, I plan to use the API in my chrome extension to subscribe and listen to podcasts, it is called podStation: I belive it can be used to generate consumer code in many different programming languages. If I undestood well you can publish it in your own website using the swagger-ui: https://github.com/swagger-api/swagger-ui |
I finished defining all the APIs, I'm taking a look on how to publish it now |
There's a openapi-spec-validator. It might make sense to include the validation in the tests, to make sure we always have a valid spec file. |
@stefankoegl I'm trying to run the tests with cmd I'm running postgres using a slightly modified version of your docker-compose file from the docker branch which exposes the port 5432. Do you have any idea what it could be? |
Do you know where exactly it gets stuck? When you press Ctrl+C when the test hangs, it should give you a stack trace. |
That actually helped, I run it with a --fulltrace and Ctrl+C showed it was stuck in some retry loop related to ampq and celery, so I realised I should be runing redis as well. |
I noticed that you added two files in |
Scheiße! That is what you get when trying to finish stuff late at night 😢 (and trying to be a purist) I actually have added I was trying to manually avoid adding this folder until the PR was merged, but as you can see I failed at that. I'll fix it. |
Hi @stefankoegl , I implemented a prototype on how to expose the openapi definition on the website using swagger-ui in this branch: https://github.com/podStation/mygpo/tree/openapi_expose you can access it at I'm not sure about embbeding it in the website this way as it limits the size and messes up a little bit with the style, perhaps it would be better to simply host the swagger-ui without wrapping it into the website ui. I'm not very happy with loading the dependencies direcly from unpkg, but also copying the resources to /static/js and adding them to git also is not ideal. It would be interesting to install the front end dependencies on travis just as the python dependencies, but that is a development of its own. Let me know your thoughts. PS: my plan is to keep the lower menu pointing to readthedocs and in there point to the swagger-ui, as some devs may be still used to the readthedocs thing, and also the api definition is not 100% complete yet. |
@stefankoegl Just a ping to check if you saw my last comment |
My understanding was that we would publish the openapi.yaml file at some public URL for the clients to consume. I didn't know that it would involve including some third party software within the gpodder.net interface. If this is necessary, it might be better to keep this as a standalone application. What do you think? |
Hi Stefan, I think it makes sense to keep it as a standalone app as you suggested. What do you think of the approach I applied at commit 603cfd3 to serve the api definition? If that is ok I can integrate that commit in my branch for this PR and point to it at the API documentation, then we can close this PR and discuss how to host the swagger UI in a different thread. |
I'm assigned this issue and currently triaging. If you have any updates, please let me know. |
Hi @dellagustin. I don't know how to generate the |
I think https://github.com/OpenAPITools/openapi-generator is used to generate code from the YAML specs, but what about the reverse process (generate YAML from existing code)? |
Because the branch has been stale for some time. I rebased and opened a new pull request #361 If you have any update, please comment under the new pull request. |
Hi @SiqingYu, First of all, thank you for picking up where I left! It was so long ago that I don't even know where I stopped. I wrote the OpenAPI specification manually as I don't know how to generate it from code, but that is a valid question. |
Thanks for your reply. I will carry on with your works. |
At the moment, response schemas are out of scope.