Actions
Bug #22963
openSome API params are documented with wrong type
Status:
New
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
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
Actions