Skip to content

Conversation

@eyeinsky
Copy link
Collaborator

@eyeinsky eyeinsky commented Dec 31, 2025

WPB-22297: Fix Swagger API description for GET /search/contacts

This fixes the issue of GET /search/results and GET /teams/{tid}/search return JSONs looking the same on their HTTP 200 responses in Swagger, while actually they should not be the same as one returns a SearchResult Contact and the other a SearchResult TeamContact.

This is due to the ToSchema generating the same key for both SearchResult Contact and SearchResult TeamContact, so one overwrites the other in the schema description. This PR uses the typeRep of a in SearchResult a to make the keys distinct.

While this fixes this particular instance, then more could exist in ToSchema instances with a type variable in the head, find these with grep -r 'instance.*=>.*ToSchema'.

I think the real fix would be to add a Typeable a constraint to the class of ToSchema a and then make all the helpers (such as the object in schema = object "SearchResult") not take a string argument at all and generate that automatically from the a instead. How this would work out would need to be researched though.

These other issues could be related:

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@eyeinsky eyeinsky requested a review from a team as a code owner December 31, 2025 11:53
@eyeinsky eyeinsky requested review from a team as code owners December 31, 2025 11:56
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants