Ticket #1438 (new enhancement)

Opened 2 years ago

Last modified 2 years ago

Action API - parameter discovery/checking

Reported by: dread Owned by:
Priority: major Milestone: ckan-future
Component: ckan Keywords:
Cc: kindly Repository: ckan
Theme: none


Many actions in the Action API require parameters. What params are needed should be listed and checked. Because currently, if you get them wrong you simply get a useless 500 error.

Currently they are listed in the docs, extracted from the code manually.

So you could GET /action/api/package_list to receive not only the help text, but a list of arguments.

And if you send an extra or missing argument then an intelligent error message can be returned.


How about some sort of decorator on the action function:

@logic_params(id, offset, limit)
def get_package_list(context, data_dict):

This would do the param checking, and is there a way to extract these params from the function? Or do a registration of the logic function?

I'd certainly like to keep the list of the list of params for the function with the function, for ease of reading the code.

Another good thing would be to pass in the params named as themselves, rather than having them contained in the data_dict.

Change History

comment:1 Changed 2 years ago by icmurray

  • Milestone changed from ckan-v1.7 to ckan-backlog

comment:2 Changed 2 years ago by icmurray

  • Milestone changed from ckan-backlog to ckan-future
Note: See TracTickets for help on using tickets.