Project

General

Profile

Actions

Bug #22964

closed

Some numeric options are no longer recognized as numeric. Tests are failing.

Added by Martin Bacovsky over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

With recent change in recognition of option types in hammer [1] we tightened condition for numeric types.
There are some params improperly documented in API that produce unexpected type descriptions such as

                  {
                    "name": "architecture_id",
                    "full_name": "hostgroup[architecture_id]",
                    "description": "\n\u003cp\u003eArchitecture ID\u003c/p\u003e\n",
                    "required": false,
                    "allow_nil": true,
                    "allow_blank": false,
                    "validator": "number.",
                    "expected_type": "string",
                    "metadata": null,
                    "show": true,
                    "validations": []
                  },

These are no longer recognized as a numeric options.

The source param looks like

  param :architecture_id, :number, :desc => N_('Architecture ID')

where the type :number is not valid type validator in Apipie. (correct ones are e.g. 'Integer' or 'Numeric' [2]3)

Prior this is fixed in API [4] Hammer should have either fixed the tests to reflect this new behavior or workaround the incorrectly typed params.

[1] https://github.com/theforeman/hammer-cli/pull/272
[2] https://github.com/Apipie/apipie-rails/blob/master/lib/apipie/validator.rb
[3] https://github.com/theforeman/foreman/blob/cb591e34f4e1f462b826a5f391bed20ceb192da3/config/initializers/apipie.rb#L71-L147
[4] http://projects.theforeman.org/issues/22963


Related issues 1 (1 open0 closed)

Related to Foreman - Bug #22963: Some API params are documented with wrong typeNew03/21/2018Actions
Actions

Also available in: Atom PDF