Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Don't allow to filter by "externalProfile" if "enrich" is not "true" #81

Open
@maxceem

Description

@maxceem

Context

During working on the TaaS API we came across with the next issue.

  • If we make a request with enrich=true everything works well, for example https://api.topcoder-dev.com/v5/users?enrich=true&externalProfile.organizationId=36ed815b-3da1-49f1-a043-aaed0a4e81ad&externalProfile.externalId=40159127 returns an array with one user
     [{"lastName":"Admin","updatedBy":"tcAdmin","created":"2021-01-06T17:10:45.336Z","handle":"max.admin","firstName":"Max","externalProfiles":[{"organizationId":"36ed815b-3da1-49f1-a043-aaed0a4e81ad","updatedBy":"tcAdmin","createdBy":"NaN","isInactive":false,"created":"2021-01-06T17:10:45.738Z","organization":{"updatedBy":"tc-Copilot","createdBy":"tc-Copilot","created":"2020-05-05T11:01:31.334Z","name":"Topcoder","skillProviders":[{"organizationId":"36ed815b-3da1-49f1-a043-aaed0a4e81ad","updatedBy":"tc-Copilot","createdBy":"tc-Copilot","created":"2020-05-05T11:01:31.334Z","skillProviderId":"7637ae1a-3b7c-44eb-a5ed-10ea02f1885d","id":"909da0a2-3c46-4ec9-9a6d-f6f3829fa07a","updated":"2020-05-05T11:02:10.574Z"}],"id":"36ed815b-3da1-49f1-a043-aaed0a4e81ad","updated":"2020-05-05T11:02:10.574Z"},"externalId":"40159127","id":"ef25ff9c-8a67-43b1-97c9-04e4cc1d0c02","uri":null,"updated":"2021-01-06T17:10:45.738Z","userId":"077fd578-7463-457f-b6ef-22c02178d7f5"}],"createdBy":"NaN","id":"077fd578-7463-457f-b6ef-22c02178d7f5","updated":"2021-01-06T17:10:45.336Z"}]
  • but if we are making the same request without enrich, then U-bahn endpoint returns some random array of multiple users instead of the required user, I guess it doesn't filter result by externalId in such case, for example URL https://api.topcoder-dev.com/v5/users?enrich=false&externalProfile.organizationId=36ed815b-3da1-49f1-a043-aaed0a4e81ad&externalProfile.externalId=40159127 returns
     [
         {"lastName":"Underwood","firstName":"Christina","updatedBy":"tcAdmin","createdBy":"Talend","created":"2021-01-20T03:56:20.459Z","handle":"christina_uw","id":"79ce2a3e-7679-48cf-8ac9-0a8ca4c4b463","updated":"2021-01-20T03:56:20.459Z"},
         {"lastName":"Mess","firstName":"Mess","updatedBy":"tcAdmin","createdBy":"Talend","created":"2021-01-20T03:56:20.443Z","handle":"mess","id":"98ec2c16-442e-4b61-8ad1-66123ee37d3c","updated":"2021-01-20T03:56:20.443Z"},
         {"lastName":"Chennaveerappa Mruthyunja","firstName":"Nagendrakumar","updatedBy":"tcAdmin","createdBy":"Talend","created":"2021-01-20T03:56:20.459Z","handle":"cmnkumar.123","id":"4dfc6090-4ba8-4387-b5c4-584fcef982ba","updated":"2021-01-20T03:56:20.459Z"},
         ... and so on
     ]

Suggestion

I suggest returning an explicit error when the user tries to filter by externalProfile but enrich !== true. As most likely user would get in response not what they are expecting.

References

We almost missed this difference in behavior and only QA caught it, see topcoder-platform/taas-apis#154 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions