Skip to content

feat(core): add searchInfo to the opportunity and award search responses - #1421

Merged
karinamzalez merged 3 commits into
CORE-v0.6.0from
karina/959-add-searchInfo-to-opp-search
Nov 23, 2026
Merged

karinamzalez merged 3 commits into
CORE-v0.6.0from
karina/959-add-searchInfo-to-opp-search

Conversation

@karinamzalez

@karinamzalez karinamzalez commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Opportunity and award search responses now confirm the search term used, through an optional searchInfo: { query } added in protocol v0.6.0. Renaming Paginated / Sorted / Filtered to match the new SearchResults name is out of scope and tracked in #1419. SDK, mock API and template support are not included.

Changes proposed

  • lib/core/lib/core/responses/success.tsp: new "200 search results response" section, all added in v0.6.0:
    • SearchResultsInfo with a required query: string
    • SearchResultsBase<ItemsT, FilterT>: FilteredBase plus an optional searchInfo, omitted when the request had no search term (empty or whitespace-only counts as none)
    • SearchResults and SearchResultsT<ItemsT, FilterT>, mirroring Filtered / FilteredT
  • lib/core/lib/core/routes/opportunities.tsp, lib/core/lib/core/routes/awards.tsp: search returns SearchResultsT; route description now mentions the search term
  • lib/core/lib/api.tsp: @returnTypeChangedFrom(v0_6, ...FilteredT...) on both search ops, so 0.1.0 to 0.5.0 keep their old response schema (same pattern as op read)
  • Regenerated outputs:
    • website/public/openapi/openapi.0.6.0.yaml: searchInfo on both search responses, plus the two new component schemas
    • website/public/openapi/openapi.0.{1..5}.0.yaml: only the search route description line changes
    • website/public/schemas/yaml/SearchResults.yaml, SearchResultsInfo.yaml: new
  • Docs (website/src/content/docs/protocol/responses/):
    • search-results.mdx: new page for SearchResults and SearchResultsInfo
    • index.mdx: card for the new page
    • error.mdx: sidebar order bumped so Search results sits after Filtered
    • success.mdx: Created and Accepted TypeSpec line ranges point at the right models again
    • filtered.mdx, sorted.mdx: example sortInfo uses the real sortBy / sortOrder fields; filtered.mdx line range and usage snippet (using CommonGrants;) fixed

Context for reviewers

The @returnTypeChangedFrom decorators in api.tsp deserve the closest look. Without them, the response schema changes in all five older OpenAPI documents.

Design decisions (name, placement, shape, optional) are recorded in this comment on #959.

To verify:

  1. Regenerate the spec: pnpm --filter website run typespec
  2. Check the new property only appears on the two search responses: grep -n searchInfo website/public/openapi/openapi.0.6.0.yaml
  3. Check older docs only change a description line: git diff origin/CORE-v0.6.0 -- 'website/public/openapi/openapi.0.[1-5].0.yaml'
  4. Open /protocol/responses/search-results/ on the preview deploy and confirm the table, example, tabs and changelog render.

Additional information

Preview: Search results page

Search results page, intro and table with the searchInfo row
pr-1421-search-results-page

Formats section, Example tab
pr-1421-search-results-example

Core CI:

$ pnpm --filter @common-grants/core run ci
...
✔ @typespec/json-schema 55ms tsp-output/@typespec/json-schema/
✔ @typespec/openapi3 358ms tsp-output/@typespec/openapi3/

Compilation completed successfully.

Website checks and tests:

$ pnpm --filter website run checks
...
- 0 errors
CSpell: Files checked: 1482, Issues found: 0 in 0 files.

$ pnpm --filter website exec vitest run
 Test Files  41 passed (41)
      Tests  1225 passed (1225)

searchInfo in openapi.0.6.0.yaml (two search responses plus the SearchResults component):

1183:                  searchInfo:
1991:                  searchInfo:
8870:        searchInfo:

Only change to the 0.1.0 to 0.5.0 documents:

-      description: Search for opportunities based on the provided filters.
+      description: Search for opportunities based on the provided search term and filters.
-      description: Search for awards based on the provided filters.
+      description: Search for awards based on the provided search term and filters.

…search routes

Opportunity and award search now return `SearchResultsT`, which extends the
filtered response with an optional `searchInfo: SearchResultsInfo { query }`
confirming the search term used. All new models are added in v0.6.0, and
`@returnTypeChangedFrom` keeps both search routes on `FilteredT` before v0.6.0.
The `searchInfo` doc says it is omitted when there is no search term (empty or
whitespace-only counts as none). The search route descriptions now mention the
search term, which also updates that one description line in the 0.1.0 to
0.5.0 OpenAPI documents; their schemas are unchanged.

Refs #959

Files changed:
- lib/core/lib/core/responses/success.tsp
- lib/core/lib/api.tsp
- lib/core/lib/core/routes/opportunities.tsp
- lib/core/lib/core/routes/awards.tsp
- website/public/openapi/openapi.0.{1,2,3,4,5,6}.0.yaml
- website/public/schemas/yaml/SearchResults.yaml
- website/public/schemas/yaml/SearchResultsInfo.yaml
Adds a Search results page under protocol/responses that documents the
`SearchResults` response and its `SearchResultsInfo` model added in v0.6.0,
with a table, example, JSON Schema and TypeSpec tabs, a usage snippet and the
changelog. Links it from the responses overview and orders it after Filtered.
Also fixes the sibling response pages: TypeSpec line ranges for Filtered,
Created and Accepted now cover the right models, the Filtered and Sorted
examples use the real `sortInfo` fields (`sortBy` / `sortOrder`), and the
Filtered usage snippet adds `using CommonGrants;` so `Filters` resolves.

Refs #959

Files changed:
- website/src/content/docs/protocol/responses/search-results.mdx
- website/src/content/docs/protocol/responses/index.mdx
- website/src/content/docs/protocol/responses/success.mdx
- website/src/content/docs/protocol/responses/filtered.mdx
- website/src/content/docs/protocol/responses/sorted.mdx
- website/src/content/docs/protocol/responses/error.mdx
@github-actions github-actions Bot added website Issues related to the website core Issues related to @common-grants/core library typescript Issue or PR related to TypeScript tooling labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Website Preview Deployed!

Preview your changes at: https://pr-1421-common-grants.agile6.workers.dev

Built from commit 05fc184

@karinamzalez karinamzalez linked an issue Nov 20, 2026 that may be closed by this pull request
3 tasks
@karinamzalez
karinamzalez merged commit ea6584e into CORE-v0.6.0 Nov 23, 2026
9 checks passed
@karinamzalez
karinamzalez deleted the karina/959-add-searchInfo-to-opp-search branch November 23, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues related to @common-grants/core library typescript Issue or PR related to TypeScript tooling website Issues related to the website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Core] Add searchInfo property to the opportunity search response

2 participants