-
Notifications
You must be signed in to change notification settings - Fork 725
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
Make REST API documentation easier to use using Swagger #928
Conversation
…ng [Swagger](http://petstore.swagger.wordnik.com). Can be accessed at: * http://127.0.0.1:5000/api/v1.1/spec.html for human-friendly UI * http://127.0.0.1:5000/api/v1.1/spec.json for JSON descriptor ![image](https://cloud.githubusercontent.com/assets/24123/3565412/c2746740-0ab8-11e4-84a7-b806b994bd1c.png) ![selection_419](https://cloud.githubusercontent.com/assets/24123/3565211/4bd83c78-0aaf-11e4-8ded-2153053882fe.png) Additional dependency is needed in `opencog/python/web/api/install_dependencies.sh` : pip install flask-restful-swagger @cosmoharrigan I hope this is acceptable. Thanks! :) Fixed opencog#927.
@ceefour The example screenshot looks nice. Swagger is a nice feature. Is it your impression that flask-restful-swagger is a stable project? Does this unit test pass in Nose after these changes? |
How do I run the unit tests? https://github.com/rantav/flask-restful-swagger is being actively developed. However, Swagger itself has a large and vibrant ecosystem. The Swagger tools (spec, JSON, web UI in JavaScript) are cross-language and not Python-specific. Meaning, for example, OpenCog's REST API's |
Indeed, I have seen Swagger before, and it looks nice. |
Here it is:
|
@ceefour Thanks. I think this is a nice change, providing usable API documentation. I believe the additional dependency on flask-restful-swagger is probably alright, since it already depends on Flask and flask-restful. If possible, please see if there is any useful information included on the wiki page here: @sebastianruder you will need this additional dependency, since you're consuming the REST API. @githart please note the additional dependency introduced here that will be necessary for the REST API unit testing to continue to occur on the continuous integration server. |
Make REST API documentation easier to use using Swagger
Thanks @cosmoharrigan :) Here's it: http://wiki.opencog.org/w/REST_API#Swagger_Documentation OpenCog REST API comes with built-in user-friendly API documentation powered by Swagger. Known Issue: For To make it available to the "outside world", all you have to do is get the dynamically generated BTW, I believe you can use GitHub Pages to host this, it can be in the Thanks @rantav for making this possible :) |
@ceefour it would be nice to replace the wiki page documentation with the dynamically generated documentation, at some point, to avoid redundancy and to expose a more user-friendly version. |
@cosmoharrigan Here it is: http://ceefour.github.io/opencog/ I can't pull request on a new branch, so you need to clone the Let me know if it works for you. |
@ceefour thanks, that looks good; can you please fork this repository: |
@githart I created the repository https://github.com/opencog/rest-api-documentation to contain the Swagger interactive REST API documentation, which, after it is generated, will be hosted by GitHub Pages. At some point, maybe we could even have that repository updated automatically when the underlying source code changes. If you have any alternate suggestions or think this isn't a good idea, just let me know. Thanks! |
Here's the browsable demo from @ceefour: |
@cosmoharrigan okay, sounds good, thanks for the heads-up! There's gotta be some git or GitHub hook that will do the update, perhaps with a GitHub subscription account (keeping things simple with no third party tools). Docker Hub (Docker's renamed automated build service) could do this, even if it seems overkill. |
@githart Yeah, it could probably be done using https://github.com/opencog/rest-api-documentation/settings/hooks The browsable API is now published at http://opencog.github.io/rest-api-documentation/ |
@cosmoharrigan I've replaced the documentation part in http://wiki.opencog.org/w/REST_API because these have entirely been copied to http://opencog.github.io/rest-api-documentation/ You can review or revert if you don't like it. |
Make REST API easier to use using Swagger.
Can be accessed at:
Additional dependency is needed in
opencog/python/web/api/install_dependencies.sh
:@cosmoharrigan I hope this is acceptable. Thanks! :)
Fixed #927.