WPB-22297: Fix ToSchema instance for SearchResult #4921
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WPB-22297: Fix Swagger API description for
GET /search/contactsThis fixes the issue of
GET /search/resultsandGET /teams/{tid}/searchreturn JSONs looking the same on their HTTP 200 responses in Swagger, while actually they should not be the same as one returns aSearchResult Contactand the other aSearchResult TeamContact.This is due to the ToSchema generating the same key for both
SearchResult ContactandSearchResult TeamContact, so one overwrites the other in the schema description. This PR uses the typeRep ofainSearchResult ato make the keys distinct.While this fixes this particular instance, then more could exist in
ToSchemainstances with a type variable in the head, find these withgrep -r 'instance.*=>.*ToSchema'.I think the real fix would be to add a
Typeable aconstraint to the class ofToSchema aand then make all the helpers (such as theobjectinschema = object "SearchResult") not take a string argument at all and generate that automatically from theainstead. How this would work out would need to be researched though.These other issues could be related:
Checklist
changelog.d