Page MenuHomeSoftware Heritage

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

Authored by anlambert on Wed, Feb 12, 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

anlambert created this revision.Wed, Feb 12, 5:56 PM

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.

anlambert updated this revision to Diff 9530.EditedFri, Feb 14, 2:07 PM

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.
anlambert updated this revision to Diff 9534.Fri, Feb 14, 2:37 PM

Fix cypress tests

anlambert updated this revision to Diff 9543.Fri, Feb 14, 4:22 PM

Rebase and really fix broken cypress tests

anlambert edited the summary of this revision. (Show Details)Fri, Feb 14, 4:26 PM
vlorentz accepted this revision.Sat, Feb 15, 11:04 AM
This revision is now accepted and ready to land.Sat, Feb 15, 11:04 AM
anlambert updated this revision to Diff 9562.Mon, Feb 17, 12:04 PM
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.Mon, Feb 17, 4:01 PM