Project

General

Profile

Bug #27107

pagination API expects strings while the values really should be numeric

Added by Evgeni Golov 4 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

https://theforeman.org/api/1.22/apidoc/v2/architectures/index.html (and all other Foreman objects) says:

page (optional) paginate results
Validations: Must be a String

per_page (optional) number of entries per request
Validations: Must be a String

If you compare this to Katello (https://theforeman.org/plugins/katello/3.12/api/apidoc/v2/activation_keys/index.html), you see:

page (optional) Page number, starting at 1
Validations: Must be a number.

per_page (optional) Number of results per page to return
Validations: Must be a number.

This is IMHO both more logical from the wording and the validations.

The problem with the Foreman approach is that if an API client actually looks at "expected_type" (which is "string" in Foreman and "numeric" in Katello), it will refuse to pass integers to the API.

Associated revisions

Revision 6c8aa5db (diff)
Added by Evgeni Golov 3 months ago

Fixes #27107 - make pagination expect numbers, not strings

This also updates the wording of the `page` param to reflect it's the
page to load, not a flag to enable pagination.

It also makes the InterfacesController use the pagination group from the
BaseController instead of defining the same params again.

History

#1 Updated by The Foreman Bot 4 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6857 added

#2 Updated by Tomer Brisker 3 months ago

  • Fixed in Releases 1.23.0 added

#3 Updated by Evgeni Golov 3 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF