Page MenuHomeSoftware Heritage

apidoc: Generate a dedicated doc view for each decorated endpoint
ClosedPublic

Authored by anlambert on Feb 12 2020, 5:56 PM.

Details

Summary

When an api endpoint only accepts POST requests, a dedicated view with
different url and name accepting GET requests has to be created in order
to display the HTML documentation.

Add a new parameter to the api_doc decorator to handle that special case.

Update:

  • in order to simplify the use of the apidoc module, create a dedicated view to display HTML documentation for each decorated endpoint.
  • the noargs parameter is still used but is no more mandatory to an endpoint without URL arguments. When set to True, it simply enables to avoid redirecting to the endpoint doc view from the endpoints list view as response data can be immediately displayed.

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

As noargs and post_only have the same effect, what about using a single argument for both, that signals a new view should be created?

As noargs and post_only have the same effect, what about using a single argument for both, that signals a new view should be created?

Indeed, it makes sense. I will adapt accordingly.

Update:

  • in order to simplify the use of the apidoc module, create a dedicated view to display HTML documentation for each decorated endpoint.
  • remove the previously introduced post_only parameter
  • the noargs parameter is still used but is no more mandatory to an endpoint without URL arguments. When set to True, it simply enables to avoid redirecting to the endpoint doc view from the endpoints list view as response data can be immediately displayed.

Rebase and really fix broken cypress tests

This revision is now accepted and ready to land.Feb 15 2020, 11:04 AM
anlambert edited the summary of this revision. (Show Details)

Rebase

anlambert retitled this revision from apidoc: Handle api endpoints accepting POST requests only to apidoc: Generate a dedicated doc view for each decorated endpoint.Feb 17 2020, 4:01 PM