Skip to content

[SDK] Implement adapter contract in @common-grants/sdk and common-grants-sdk #743

Closed as not planned

Description

@SnowboardTechie

Summary

Implement the adapter contract defined in ADR 0022 in both @common-grants/sdk (TypeScript) and common-grants-sdk (Python). This means creating the createAdapter factory (TS) and Adapter class (Python) that accept an AdapterConfig and return an object with a transform(source) method returning a validated CommonGrants model.

Acceptance Criteria

  • @common-grants/sdk exports createAdapter(schema, config) returning an object with transform(source): z.infer<typeof schema>
  • common-grants-sdk exports Adapter(model, config) with transform(source_data) -> model_instance
  • Both implementations satisfy the structural contract (TS interface / Python Protocol) defined in ADR 0022
  • Both implementations support declarative (mappings) and imperative (custom transform()) construction paths
  • Unit tests cover: declarative transform, imperative transform, invalid config rejection

Related

Activity

  1. added a commit that references this issue on Apr 20, 2026
  2. widal001 commented on Apr 21, 2026

    @widal001
    Collaborator

    @SnowboardTechie small note -- I would recommend splitting this ticket into two, one for Python SDK and one for TypeScript SDK. That's what we did for:

  3. SnowboardTechie commented on Apr 22, 2026

    @SnowboardTechie
    CollaboratorAuthor

    Good call, thanks @widal001! I've split this into:

    I also took the opportunity to refresh the bodies to match the post-rework Plugin framework shape (the expanded definePlugin() / define_plugin() with schemas.<Object> = { native, common, toCommon, fromCommon }), since the original text here pre-dated that rework.

    Closing this one as superseded. Sibling issues #744–#746 have similar stale framing and I'll freshen those in a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sdkIssue or PR related to our SDKs

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions