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

[RHCLOUD-39048] fix the error message for invalid 'type' and 'principal_type' query param value #1592

Merged

Conversation

petracihalova
Copy link
Contributor

@petracihalova petracihalova commented Mar 26, 2025

Link(s) to Jira

Description of Intent of Change(s)

if you send request to list principals with invalid type value, the response contains Principal.Types.SERVICE_ACCOUNT for service-account value and similar for user value

{
    "errors": [
        {
            "detail": "type query parameter value 'foo' is invalid. [Principal.Types.SERVICE_ACCOUNT, Principal.Types.USER, 'all'] are valid inputs.",
            "source": "detail",
            "status": "400"
        }
    ]
}

this PR adds logic to convert values into strings

{
    "errors": [
        {
            "detail": "type query parameter value 'foo' is invalid. ['service-account', 'user', 'all'] are valid inputs.",
            "source": "detail",
            "status": "400"
        }
    ]
}

Local Testing

send request GET /principals/?type=foo
send request GET /groups/<uuid>/principals/?principal_type=foo

@petracihalova petracihalova changed the title fix the error message for invalid 'type' and 'principal_type' query param value [RHCLOUD-39048] fix the error message for invalid 'type' and 'principal_type' query param value Mar 26, 2025
@petracihalova petracihalova force-pushed the type-query-param-invalid branch from e4af84f to 14c54e5 Compare March 26, 2025 11:28
@petracihalova
Copy link
Contributor Author

I added DO NOT MERGE label because we need to merge #1558 first and this PR has potential to create merge conflicts

@petracihalova petracihalova merged commit 8e12a4d into RedHatInsights:master Mar 27, 2025
12 checks passed
@petracihalova petracihalova deleted the type-query-param-invalid branch March 27, 2025 11:48
@vbelchio
Copy link
Contributor

vbelchio commented Mar 28, 2025

QE: Passed (manual)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants