Closed 0x0elliot closed 2 years ago
Probably set up sphinx
in the doc
first.
do you want 2 documentations? one for the code generated via sphinx, and the other for the API done via redoc?
one. how IntelOwl does it basically here: https://intelowl.readthedocs.io/
check out their docs.
okay so more context. docs would be/have been set up separately. as far as i understand, a schema.yml is referenced from somewhere. from the API endpoint I have enabled (localhost:8000/openapi) you would be able to fetch the schema. I want it to be dumped automatically to the doc folder and then referenced off of rather than manual updation.
can we pull this off using GitHub actions triggered after each merge to master @RoguedBear ?
fetching the schema from the API endpoint and then dumping it to the docs folder can be done via actions. Is there anything else in the documentation aspect you want to automate?
not anything i can think of other than making sure that redoc with sphinx picks it up automatically and the older schema.yml is deleted.
if that's too hard, we can instead do something like this: https://intelowl.readthedocs.io/en/latest/Contribute.html#note-about-documentation using something like spectacular
it's wayyy more elegant.
now that you've mentioned how IntelOwl does it, I'll be trying 3 approaches and see what works best
/openapi
endpointwhatever is the easier one. maybe spectacular would be able to dump it simply in CI mode.
so i tried methods 1 & 2, both give a little different schema.
mainly all you gotta do is run ./manage.py generateschema --file openapi-schema.yml
source: https://www.django-rest-framework.org/api-guide/schemas/#generating-a-static-schema-with-the-generateschema-management-command
I am unsure right now, how this inbuilt command is different from spectacular
/openapi
endpointAs for using spectacular, that requires you to configure some config files in django (see here)
It would be really helpful for me if you can diffcheck both the schemas and tell which one is the more appropriate one, since one difference b/w both that stumped me was that the cli generated one contained the schema for /authentication/logout
but when getting it from /openapi
that part was missing.
the former one!
godspeed for #4
exactly what the title says. won't do it right now. easy to approach for a DevOps beginner.
Probably have a
doc
file there which gets automated and a redoc + sphinx service (deployed it here: https://urnode.readthedocs.io/) is automatically deployed off of. The why's and hows can be debated!