ckan / ckan

CKAN is an open-source DMS (data management system) for powering data hubs and data portals. CKAN makes it easy to publish, share and use data. It powers catalog.data.gov, open.canada.ca/data, data.humdata.org among many other sites.
https://ckan.org/
Other
4.43k stars 1.98k forks source link

API guide: Action API reference does not define context #4944

Open Chealer opened 5 years ago

Chealer commented 5 years ago

CKAN's Action API reference lists several functions which require a context parameter, such as

ckan.logic.action.get.package_list(context, data_dict)

It is not explained how to define that parameter.

wardi commented 5 years ago

We're using the sphinx auto documentation feature to expose the API endpoints available, but our internal action functions take their parameters as an internal-only context dict and a user-provided data_dict dict. All the paramters described in the docstrings end up in the internal data_dict parameter.

We could extend sphinx to change the way these parameters appear in the generated documentation to clean this up. Is that something you'd like to help with? There could be another approach to this, but we should keep extracting the API documentation from the action functions so we don't end up with duplicated or outdates docs.

Chealer commented 5 years ago

Thank you wardi, that makes sense. Your proposal seems like a significant job which should ideally be done by someone familiar with the documentation tools (unlike me, who never heard of sphinx), but I agree it is ideal. Since this could take time though, I suggest just adding a warning at the top of the Action API reference section (indicating that these parameters should be ignored).

I agree that extracting documentation from action functions sounds best, if it is possible.