Skip to content

feat(core): add models and routes for awards#1008

Open
widal001 wants to merge 6 commits into
HOLD-core-v0.4.0from
954-awards-models-routes
Open

feat(core): add models and routes for awards#1008
widal001 wants to merge 6 commits into
HOLD-core-v0.4.0from
954-awards-models-routes

Conversation

@widal001

@widal001 widal001 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds models and routes that support awards to the @common-grants/core library and the protocol docs on the website.

Changes proposed

What was added, updated, or removed in this PR.

  • Adds Awards endpoints and associated models, largely matching the Opportunities endpoints
    • List awards: GET /common-grants/awards/
    • Search awards: GET /common-grants/awards/search/
    • View award details GET /common-grants/awards/{awdId}
  • Creates new reference models for existing models referenced by the Awards, while trying to establish more of a pattern for the shape of these references across domain models (e.g. { id, name/title, identifiers })
    • OppRef
    • OrgRef
    • AppRef
  • Renames ApplicationBase.name to ApplicationBase.title to match the title convention in OpportunityBase and AwardBase
  • Adds the new models and routes to the website docs
  • Updates the pnpm typespec:openapi to strip OpenAPI tags that don't have any routes in earlier versions. The default @typespec/openapi3 leaves in tags in earlier versions even if they don't contain routes in that version.

Context for reviewers

Testing instructions, background context, more in-depth details of the implementation, and anything else you'd like to call out or ask reviewers. Explain how the changes were verified.

Instructions to review

  1. Visit the PR preview: https://cg-pr-1008.billy-daly.workers.dev/
  2. Check out the new Awards models: https://cg-pr-1008.billy-daly.workers.dev/protocol/models/award/
  3. Review the OpenAPI docs:
    • v0.4.0 should have an Awards section
    • None of the previous versions should have Awards sections
    • v0.1.0 should only have Opportunity, required, and optional

Notes

  • Most of the files/LOC that were changed are in the src/public/schemas/yaml/ and `src/public/openapi/. Historically we've committed the latest version of files in this directory because they help us catch unexpected drift between versions, but as the number of schemas and routes grows, we might want to revisit that policy to keep our PRs smaller.
  • There are a few other changes we'll want to make to the models around Awards outlined in this doc that I intentionally deferred to limit an even larger set of breaking changes in this PR.
  • I prefixed the award sub-models with Awd to match the prefix in the ID registry (and follow the pattern of Opportunity -> Opp and Application -> App) but I could be persuaded to use the full Award instead.

Additional information

Screenshots, GIF demos, code examples or output to help show the changes working as expected.

Awards models

Screenshot 2026-07-15 at 12 38 51 AM Screenshot 2026-07-15 at 12 39 13 AM

Latest OpenAPI version

Screenshot 2026-07-15 at 12 39 37 AM

Filtering OpenAPI tags by version

Screenshot 2026-07-15 at 12 40 01 AM

Ref models

Screenshot 2026-07-15 at 12 40 47 AM

widal001 added 4 commits July 14, 2026 22:22
Adds a lightweight reference model for opportunities, applications, and
organizations (OppRef, AppRef, OrgRef, plus an OrgRefCollection for
grouping organizations). A reference model previews the key fields a
consumer needs to identify a record and look it up or join it to
another response, without repeating the full model.

Each base model now includes its own reference model, so the reference
always matches the fields on the base, and any later change to those
shared fields appears in the base model's changelog. Record ids are
also now read-only across these models, matching opportunities.

Also renames the application's `name` field to `title`, for
consistency with the other models and the new reference models.
Adopters reading application data at protocol version 0.4.0 should
expect `title` in place of `name`.
Adds AwardBase, a model for reporting on a grant award: its funder,
recipient, financial amounts, and key dates, along with references to
the opportunity and application it resulted from. Awards can name
either an organization or an individual as the recipient.

Adds three endpoints an adopter can offer for awards:
- list awards: GET /common-grants/awards/
- view an award: GET /common-grants/awards/{awdId}
- search awards: POST /common-grants/awards/search

Available at protocol version 0.4.0 and marked experimental, so the
shape may still change before it becomes a stable part of the protocol.
Adds an Award page under Protocol > Models covering the award model
and its supporting types. Each reference model is documented on the
page for the model it points to (opportunity, application, and
organization). Regenerates the published schemas and OpenAPI
specification so the new models appear in the docs.
Adds a build step after the OpenAPI generation that removes any tag from
a version's tag list when none of that version's routes use it. TypeSpec
lists every tag in every version, so earlier versions advertised tags
like Awards or Competitions that only have routes in later versions.

Now each version's docs only list tags a consumer can actually find
routes for. The step edits only the tag list, so the rest of each
generated file stays unchanged.
@github-actions github-actions Bot added website Issues related to the website core Issues related to @common-grants/core library dependencies Pull requests that update a dependency file typescript Issue or PR related to TypeScript tooling labels Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Website Preview Deployed!

Preview your changes at: https://cg-pr-1008.billy-daly.workers.dev

This preview will be automatically deleted when the PR is closed.

widal001 added 2 commits July 15, 2026 00:33
Removes recipientType (and the AwdRecipientType enum and search filter)
from the award model. The recipient is already conveyed by whichever
field is populated, recipientOrganizations or recipientIndividual, so
the separate discriminator was redundant, and it is not present in most
of the award standards we reviewed. Awards are experimental, so an
explicit recipient type can be added later if one is needed.
Documents AwdIdFain on the award model page, which was missing, and adds
v0.4.0 as the latest option in the API docs version dropdown so its
routes (including awards) are viewable. Also regenerates the schemas
after the recipientType removal.
@widal001 widal001 requested a review from SnowboardTechie July 15, 2026 04:41

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The changes in this file and the other pre v0.4.0 are because of the new script that I added that removes OpenAPI tags that don't have any associated routes in a given version.

description: The base model for an application to a competition for a funding opportunity
example:
id: 123e4567-e89b-12d3-a456-426614174000
name: My Application

@widal001 widal001 Jul 15, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The one tradeoff around examples and versioning in schemas is that example properties that were renamed seems to just drop the property instead of renaming it in previous versions.

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 dependencies Pull requests that update a dependency file 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.

[Award routes] Add award models to the website docs [Award routes] Add routes and models for awards

1 participant