IntelOwl icon indicating copy to clipboard operation
IntelOwl copied to clipboard

[docs] Proper API specs/docs using Swagger

Open eshaan7 opened this issue 4 years ago • 12 comments

  • Writing proper documentation for the API endpoint functions (api_app/api.py)

Need to use proper syntax as given here. Originally posted by @Eshaan7 in https://github.com/intelowlproject/IntelOwl/pull/344#issuecomment-786725761

  • Using https://www.django-rest-framework.org/topics/documenting-your-api/ to generate docs and API specs
  • Use this to create the spec file, and then use the sphinx-redoc extension to generate redoc along with rest of the docs. Then link both docs together with something like this. There should be a GH workflow setup for this.

eshaan7 avatar Jan 20 '21 18:01 eshaan7

assign me this issue

spiderxm avatar Jan 26 '21 19:01 spiderxm

It's been a while since this was assigned to someone. I'd like to work on this if it's open for contribution!

purhan avatar Feb 24 '21 11:02 purhan

hey @Purhan thank you for your interest in the project! You have been assigned

mlodic avatar Feb 24 '21 11:02 mlodic

@mlodic Thanks for assigning! I have created a PR. Review will be appreciated.

purhan avatar Feb 25 '21 13:02 purhan

Also I think we should rewrite the docstrings of the APIs because swagger cannot parse that data correctly.

Yes, it's our mistake for not following a proper syntax while writing doc strings.

Need to use proper syntax as given here.

descriptions for Operations, Parameters and Schemas are picked up from docstrings and help_text attributes in the same manner as the default DRF SchemaGenerator

Originally posted by @Eshaan7 in https://github.com/intelowlproject/IntelOwl/issues/344#issuecomment-786725761

So, Before diving into swagger, We have to fix doc strings, Right? Let me do that then.

CITIZENDOT avatar Mar 11 '21 09:03 CITIZENDOT

solved with #417

mlodic avatar Apr 15 '21 15:04 mlodic

The GH action automation part of this issue still needs to be done. (could use https://github.com/NiklasRosenstein/readthedocs-custom-steps/)

eshaan7 avatar Apr 30 '21 15:04 eshaan7

Hey, can anyone clarify what part of this issue is solved and what needs to be implemented more?

uzaxirr avatar Dec 09 '21 15:12 uzaxirr

Hello! Is this issue still open? If so can you clarify what needs to be done? Thanks!

fear-the-reaper avatar Feb 21 '22 21:02 fear-the-reaper

Honestly I did not understand what @eshaan7 meant by that. I guess this could be closed

mlodic avatar Feb 22 '22 11:02 mlodic

The schema.yml file is not automatically updated and we need a GitHub action to manage this. (As you can see even right now, the schema.yml file says the version is 3.1.0 even though we are on 3.3.0)

This workflow could be made part of the existing sphinx_build_on_release.yml file.

The schema.yml file is generated using the drf-spectacular django app using the following management command:

$ python manage.py spectacular --file docs/source/schema.yml

eshaan7 avatar Feb 22 '22 11:02 eshaan7

Yeah plus I honestly don't like the result we had with Redoc and would preferably move to Swagger.

mlodic avatar Jul 14 '22 12:07 mlodic

superseded by #2043

mlodic avatar Dec 29 '23 14:12 mlodic