Skip to content

Add 400 response for invalid sort.order on POST /contacts/search#567

Merged
dan0505 merged 3 commits into
mainfrom
dq/contacts-search-sort-order-spec
Jun 25, 2026
Merged

Add 400 response for invalid sort.order on POST /contacts/search#567
dan0505 merged 3 commits into
mainfrom
dq/contacts-search-sort-order-spec

Conversation

@dan0505

@dan0505 dan0505 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Why?

The contacts search endpoint previously coerced any unrecognised sort.order value to descending. It now rejects unrecognised values with an invalid_sort_order 400, so the spec should document that response.

How?

Add a 400 response (with an invalid_sort_order example) to the POST /contacts/search operation. sort.order accepts ascending or descending.

Generated with Claude Code

The contacts search endpoint now returns 400 with an invalid_sort_order
error when sort.order is not "ascending" or "descending".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@zilleeizad-inter zilleeizad-inter left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review question on the new contacts-search 400 example — for the author's consideration.

~ Automated via Claude

value:
type: error.list
errors:
- code: invalid_sort_order

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 400 example omits request_id, but the 401 example just above on this same operation includes one — and nearly all error.list examples in this spec carry it. Should we add a request_id here so the example matches the established shape?

~ Automated via Claude

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added — request_id is now on the 400 example (commit 1d08c79), matching the 401 just above and the rest of the spec. This keeps it in sync with the developer-docs PR (#999), where the same change landed.

~ Automated via Claude

dan0505 and others added 2 commits June 25, 2026 14:30
- Add a contact_search_request schema (sort.field + sort.order enum:
  ascending/descending, default descending) and point POST /contacts/search
  at it. Conversations and tickets searches keep the shared search_request.
- Add request_id to the 400 invalid_sort_order example for parity with the
  rest of the spec.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reword so valid values aren't implied to 400: "Values other than
`ascending` or `descending` return a 400 error" instead of "Any other
value". Keeps the contacts search schema in sync with developer-docs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@zilleeizad-inter zilleeizad-inter left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Verified byte-identical to the source-of-truth developer-docs#999 (this spec is manually derived from it): the 400 example, the requestBody repoint to contact_search_request, and the new schema block all match. request_id present in the 400 example per spec convention; scoping to the Preview spec (descriptions/0/) is correct since the backend validation is version-gated.

~ Automated via Claude

@dan0505 dan0505 merged commit dea74ee into main Jun 25, 2026
3 checks passed
@dan0505 dan0505 deleted the dq/contacts-search-sort-order-spec branch June 25, 2026 14:20
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.

2 participants