Repository navigation
feat(ts-sdk): bind award custom fields to the plugin client - #1299
Merged
Merged
Conversation
This was referenced Oct 13, 2026
SnowboardTechie
self-requested a review
October 13, 2026 21:29
SnowboardTechie
left a comment
Collaborator
There was a problem hiding this comment.
Should #1294 land #1242 first, with this one based on its branch? This carries the #1242 commits from #1294, but an older version: shorter awards.ts JSDoc, and it's missing #1294's README fix. Landing #1294 first keeps the reviewed version and cuts this diff down to #1246. I'll hold off approving until that's settled.
Base automatically changed from
karina/1156-zod-schemas-for-award-models
to
main
October 13, 2026 23:02
karinamzalez
added a commit
that referenced
this pull request
Oct 14, 2026
Thread the mapping direction into validateOutputPaths so the thrown error labels fromCommon failures as fromCommonMapping (not toCommonMapping) and only shows the customFields hint for toCommon output, since custom fields are a CommonGrants concept that does not apply to source-schema output. Addresses PR #1299 review feedback. Refs #1246
karinamzalez
force-pushed
the
karina/1246-award-custom-fields
branch
from
October 14, 2026 00:38
5125e2d to
8c59dbb
Compare
Collaborator
Author
|
Settled by rebasing onto |
SnowboardTechie
approved these changes
Oct 14, 2026
This was referenced Oct 14, 2026
…ransforms Forward sourceSchema to buildTransforms in the mappings path so fromCommon output is validated against the declared source schema. Skip validateOutputPaths for schemas with a non-never catchall (.loose()/.catchall(...)) so a loose source schema does not throw at build time for legitimately-accepted keys. Add AwdRecipientIndividual behavior tests covering custom-field validation, base fallback, both transform paths and directions, invalid-output errors, and resource independence. Refs #1246
The award envelope has no top-level custom fields; its only extensible surface is the nested recipientIndividual. buildClientForPlugin now composes the plugin's compiled AwdRecipientIndividual schema into AwardBaseSchema at that key, so get/list/search parse and type the extension by default instead of always falling back to the fixed base schema. Per-call schema overrides still take precedence, and plugins with no award custom fields behave identically to the base schema. Refs #1246
Add an AwdRecipientIndividual custom-field example and the expanded extensible-model reference to the extensions guide, document plugin-bound award client calls and schema precedence in the client guide, and make explicit in both guides that client parsing does not invoke source-system transforms and that declaring a custom field does not register a search filter. Fix the grants.gov transform example to accept the Date values the declarative field handler passes through for created_at/last_modified_at. Refs #1246
Note that .passthrough() also lands in the catchall-skip branch alongside .loose()/.catchall(...), and that .def is Zod v4's public introspection API (undefined catchall for a plain z.object(), so plain objects stay validated). Comments only; no behavior change. Refs #1246
Thread the mapping direction into validateOutputPaths so the thrown error labels fromCommon failures as fromCommonMapping (not toCommonMapping) and only shows the customFields hint for toCommon output, since custom fields are a CommonGrants concept that does not apply to source-schema output. Addresses PR #1299 review feedback. Refs #1246
karinamzalez
force-pushed
the
karina/1246-award-custom-fields
branch
from
October 14, 2026 15:13
8c59dbb to
fb33b10
Compare
1 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Rebased onto
mainnow that #1290 (award Zod schemas), #1294 (awards client resource), and #1295 have landed. The duplicate #1242 commits this branch previously carried are gone; the diff is reduced to the #1246 custom-fields work on top of the merged award client.Changes proposed
lib/ts-sdk/src/client/resources/registry.ts: addnestedSchemaName: "AwdRecipientIndividual"to theawardsregistry entry (and its type), since the award envelope has no top-levelcustomFields; only the nestedrecipientIndividualis extensible.lib/ts-sdk/src/client/resources/builder.ts: addResolvedAwardItemTypeand compose a plugin's compiledAwdRecipientIndividualschema into the base award envelope'srecipientIndividualkey, rather than swapping the top-level envelope schema the way opportunities do.lib/ts-sdk/src/extensions/define-plugin.ts: forwardsourceSchemaintobuildTransformsso reverse (fromCommon) output is validated against the declared source schema instead of skipping that check.lib/ts-sdk/src/extensions/transforms.ts: skip output-path key validation for schemas with a non-nevercatchall (.loose()/.catchall(...)), since those accept keys outside their declared shape by definition; make thevalidateOutputPathserror direction-aware sofromCommonfailures readfromCommonMappingand thecustomFieldshint only shows fortoCommon(addresses review feedback).lib/ts-sdk/src/client/README.md,lib/ts-sdk/src/extensions/README.md: document the nested-award-model extension pattern, plugin-bound award client calls with schema precedence, and thatschemas.AwdRecipientIndividual.customFieldsandroutes.awards.search.filtersare independent extension points.lib/ts-sdk/examples/transforms.ts: fix the grants.gov example so it accepts theDatevalues the declarative field handler passes through forcreated_at/last_modified_at, and supply the now-validatedopportunity_idsource field.__tests__/client/award-client-types.ts(new),__tests__/extensions/define-plugin.spec.ts,__tests__/extensions/get-client.spec.ts,__tests__/extensions/transforms.spec.tscover both transform authoring paths overAwdRecipientIndividual, plugin-bound award client typing, resource isolation, and the direction-aware output-path error.Context for reviewers
Award custom fields live only on the nested
recipientIndividual, not onAwarditself.AwardBasehas no top-levelcustomFieldsand adding one would be a Core change, out of scope. Binding the award client therefore composes the plugin's compiled recipient-individual schema into the base envelope (registry.ts'snestedSchemaName+builder.ts'sResolvedAwardItemType) rather than following the opportunities pattern of swapping a top-level schema.Verified by running, from
lib/ts-sdk/:pnpm run checks(lint, format,tsc --noEmit) — passpnpm run build(tsc + TypeSpec compile) — passpnpm run test(684 tests) — passpnpm run example:transforms— passes end to endAdditional information
None.