GithubHelp home page GithubHelp logo

openedx / api-doc-tools Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 12.0 423 KB

Tools for writing and generating API documentation for edX REST APIs

License: Apache License 2.0

Makefile 11.01% Python 88.99%

api-doc-tools's People

Contributors

aht007 avatar alangsto avatar awais786 avatar brian-smith-tcril avatar bseverino avatar dependabot[bot] avatar edx-requirements-bot avatar feanil avatar iamsobanjaved avatar jawayria avatar kdmccormick avatar mraarif avatar mumarkhan999 avatar nedbat avatar rgraber avatar sarina avatar stvstnfrd avatar timmc-edx avatar usamasadiq avatar xitij2000 avatar ziqixiao avatar zubairshakoorarbisoft avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-doc-tools's Issues

Add edx-api-doc-tools to edx-cookiecutters

The edX API Documentation tools (GitHub, ReadTheDocs) are a flexible and friendly way to incrementally document HTTP APIs, allowing one to start with mostly auto-generated docs, and then use decorators to move towards fully-documented API catalogs.

Our previous strategy for generating API documentation (counting on Swagger to auto-parse the docstrings) is no longer supported.

Currently, at least edx-platform and Registrar use the library. (Registrar counts on the library to generate partner-facing API documentation). The edx-api-doc-tools library should be installed into the edx-cookiecutters so that it is available by default in new Django IDAs.

Get readthedocs auto-published

  • Auto-build docs on PRs.
  • Eventually, fail PRs if docs don't build
  • In IDAs, push docs on releases (which should be tagged!)
  • In edx-platform, on master merges or weekly or release, push docs to RTFD

Handle paginated responses better

Sometimes, drf-yasg can't figure out the appropriate serializer for a class. That's not a problem if we have a serializer on hand to pass to schema:

@schema(responses={200: MySerializer})
def get(...):
    """ My view """

For paginated views, this becomes a problem, because we don't have a paginated serializer to give schema.

I see two solutions to this:

1. Help drf-yasg figure out paginated serializers better

Why can't drf-yasg generate a correct paginated response schema? Are we missing a class variable on our views? Are we using DRF wrong?

2. Provide a manual paginate_serializer function as a fall-back

In the case where drf-yasg just can't figure out the response schema, it'd be great to be able to do something like:

@schema(responses={200: paginate_serializer(MySerializer, MyPaginationClass)})
def get(...):
    """ My paginated view """

Allow better customization of the /api-docs page.

A lot of value in documentation comes from introduction paragraphs, section structure, etc.

Right now, the /api-docs page is a big list of endpoints.

How can we allow for better customization of the /api-docs page to make it a better experience for consumers of API documentation?

There is a lot of room for discovery and experimentation here.

support for APIs that are not in /api/

I wanted to add this dependency to edx-analytics-data-api in https://github.com/edx/edx-analytics-data-api/pull/329, but some of the APIs there are not in the root path /api, for instance there are some APIs under /enterprise/api/ that are taken from https://github.com/edx/edx-enterprise-data

How should I do that?

I think that we could make that the ApiSchemaGenerator takes the root path from the django settings or as a parameter passed when it is being instantiated.

What do you think?

Consider pinning drf-yasg in setup.py `install_requires`

Different versions of drf-yasg may break or change the behavior of api-doc-tools.

Thus, if drf-yasg is upgraded in a service, it may seem like api-doc-tools changed, even if that package's version did not change.

I recommend that we require a specific version of drf-yasg as an installation requirement of edx-api-doc-tools. Ideally, this pin could be continuously updated by make upgrade PRs in this repo.

As far as I know, no edX repository other than this one directly depends on drf-yasg, so we shouldn't see issues with conflicting version constraints.

Test api-doc-tools on Python 3.11

This repository is a depedency of edx-platform and needs to be upgraded to Python 3.11 before
the Readwood release is cut (mid-April).

  • Requirements are compiled with Python 3.8
  • Tests are run on Python 3.8 and 3.11
  • (Optional) Tests are also run with 3.12 and passing or 3.12 issues are ticketed.
  • Classifiers in setup.py setup.cfg or pyproject.toml indicate Python 3.11 support
  • A new version is release to PyPI
  • A PR is merged to edx-platform to use the new version

Can we ignore single line breaks in docstrings?

It's common hard-wrap docstrings to abide by max-line-length conventions:

class MyView(...):    
    def get(...):
        """
        Do a thing.

        This is my long and very helpful description of what my endpoint is for
        which I am manually breaking into two lines.
        """

which yields:

This is my long and very helpful description of what my endpoint is for
which I am manually breaking into two lines.

It'd be nice to instead see the soft-wrapped version in the output:

This is my long and very helpful description of what my endpoint is for which I am manually breaking into two lines.

Of course, double-line breaks should still be regarded as actual line breaks in the output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.