Project

General

Profile

Actions

Bug #22963

open

Some API params are documented with wrong type

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

Status:
New
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

There are many params across the whole API with invalid type validators. This is producing invalid types in API description which has impact on option validation in CLI.

For example, there is :architecture_id in the hostgroup controller using :number as a type instead of Numeric or Integer

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

producing documentation with invalid expected_type

                  {
                    "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": []
                  },

While documenting params in the API documentation we should use only valid type Validators [1]2.

[1] https://github.com/Apipie/apipie-rails/blob/master/lib/apipie/validator.rb
[2] https://github.com/theforeman/foreman/blob/cb591e34f4e1f462b826a5f391bed20ceb192da3/config/initializers/apipie.rb#L71-L147


Related issues 2 (0 open2 closed)

Related to Hammer CLI - Bug #22964: Some numeric options are no longer recognized as numeric. Tests are failing.ClosedTomáš Strachota03/21/2018Actions
Related to Katello - Bug #23287: apipie param type :number is not a valid validatorClosedAndrew KofinkActions
Actions #1

Updated by Martin Bacovsky over 6 years ago

  • Related to Bug #22964: Some numeric options are no longer recognized as numeric. Tests are failing. added
Actions #2

Updated by Andrew Kofink over 6 years ago

  • Related to Bug #23287: apipie param type :number is not a valid validator added
Actions

Also available in: Atom PDF