Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error message when input validation check failed for select parameter #98

Merged
merged 5 commits into from
Jun 8, 2018

Conversation

mgmacias95
Copy link
Contributor

Hello team,

When an invalid character was used with the select parameter, the following error was shown:

# curl -u foo:bar "localhost:55000/agents?pretty&select=os.platform"
{
   "error": "Undefined error.",
   "message": "Undefined error..  Field: select"
}

This is not correct since the error is not being controlled correctly. This PR fixes that, showing the following message:

# curl -u foo:bar "localhost:55000/agents?pretty&select=os.platform"
{
   "error": 619,
   "message": "Param not valid. Valid characters: a-z A-Z 0-9 space . , _.  Field: select"
}

Also, the character . has been added as valid to allow selecting fields such as os.platform and os.version:

# curl -u foo:bar "localhost:55000/agents?select=status,os.platform,os.version&pretty"
{
   "error": 0,
   "data": {
      "totalItems": 2,
      "items": [
         {
            "status": "Active",
            "os": {
               "platform": "centos",
               "version": "7"
            },
            "id": "000"
         },
         {
            "status": "Active",
            "os": {
               "platform": "centos",
               "version": "7"
            },
            "id": "001"
         }
      ]
   }
}

Best regards,
Marta

@jesuslinares jesuslinares changed the base branch from 3.2 to 3.3 June 8, 2018 10:13
@jesuslinares jesuslinares merged commit 9391af2 into 3.3 Jun 8, 2018
@jesuslinares jesuslinares deleted the fix-3.2-input-validation-select-error branch June 8, 2018 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants