Skip to content

Generate the modular Go SDK's field mapping in climod with genkit's cli-mod mode - #7268

Draft
parthban-db wants to merge 1 commit into
mainfrom
parthban/sdk-go-field-paths
Draft

parthban-db wants to merge 1 commit into
mainfrom
parthban/sdk-go-field-paths

Conversation

@parthban-db

@parthban-db parthban-db commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Adds climod/, a genkit target in the new cli-mod mode, which maps every field of the modular Go SDK (github.com/databricks/sdk-go) to its JSON path. It generates two files from the same data:

  • climod/.codegen/sdk-go-field-paths.txt, the mapping for people. For each request and response message, it lists every field's Go path next to the JSON path that the SDK writes:

    postgres/v1 CreateBranchRequest
      Parent                             parent
      BranchId                           branch_id
      Branch.Spec.SourceBranch           branch.spec.source_branch
      Branch.Spec.Expiration.Ttl         branch.spec.ttl
      ...
    

    A oneof member's Go path goes through the oneof field, while its JSON path doesn't, for example Spec.Expiration.Ttl and spec.ttl. [*] is a list element and .* is a map value, the same notation as libs/structs/structpath.

  • climod/.codegen/cli.json, the same mapping for code, in the shape of .codegen/cli.json. Each message is keyed by package path and Go type, and each field by its JSON name, with the Go path and a ref to nested messages:

    "postgres/v1.BranchSpec": {
      "fields": {
        "source_branch": { "go": "SourceBranch" },
        "ttl": { "go": "Expiration.Ttl" }
      }
    }

task generate-clijson now also builds the Go SDK's proto descriptor set at the pinned Universe commit and runs genkit experimental-update-sdk --dir climod to refresh both files.

Why

The modular Go SDK's public structs carry no JSON tags, so a developer can't tell from the Go type which JSON field a struct field becomes. Its names also differ from the classic SDK's names in .codegen/cli.json, for example postgres/v1.BranchSpec with the oneof Expiration, against postgres.BranchSpec with a plain ttl field. So the files come from the Go SDK's own proto view, through a genkit mode like the SDKs', rather than from the OpenAPI spec. The mode can grow to carry more of what the CLI needs about the modular SDK.

This PR depends on the genkit change that adds the cli-mod mode, which hasn't merged in Universe yet. Until .codegen/_openapi_sha points at a Universe commit that has the mode, task generate-clijson fails at the new step, so this PR should merge only after that pin bump. The committed files were generated from the Universe change itself. The automated SDK bumper runs update-sdk on its own and doesn't refresh climod/ yet; that is a follow-up.

Tests

  • The genkit change has unit tests for the field mapping (oneofs, lists and maps of messages, nested, recursive, and empty messages) and for both exact files the mode writes.
  • I ran the mode on the current Go SDK view. The text file covers 1,575 request and response messages, cli.json has 2,975 messages, and every ref resolves to a schema in the file.
  • The edited Taskfile.yml parses. I didn't run task generate-clijson end to end, because the pinned Universe commit doesn't have the new mode yet.

This pull request and its description were written by Isaac.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 6917043

Run: 41104019102

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 281 15 5:29
✅​ aws-windows-latest-4core-16gb 283 13 4:09
✅​ azure linux-2core-8gb 280 15 5:55
✅​ azure-windows-latest-4core-16gb 282 13 4:12
✅​ gcp linux-2core-8gb 281 15 6:06
✅​ gcp-windows-latest-4core-16gb 283 13 3:37
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:07 gcp linux-2core-8gb TestAccept
4:07 azure-windows-latest-4core-16gb TestAccept
4:05 aws-windows-latest-4core-16gb TestAccept
3:47 aws linux-2core-8gb TestAccept
3:43 azure linux-2core-8gb TestAccept
3:30 gcp-windows-latest-4core-16gb TestAccept

@parthban-db
parthban-db force-pushed the parthban/sdk-go-field-paths branch from eb8f623 to 9c36f74 Compare October 30, 2026 17:39
@parthban-db parthban-db changed the title Add the JSON path of every modular Go SDK field to .codegen Generate the modular Go SDK's CLI spec in climod with genkit's cli-mod mode Oct 30, 2026
…li-mod mode

The modular Go SDK's structs carry no JSON tags, and its names differ from the classic SDK names in .codegen/cli.json. task generate-clijson now also runs genkit's cli-mod mode on climod/, which writes climod/.codegen/sdk-go-field-paths.txt, with every request and response field's Go path next to its JSON path, and climod/.codegen/cli.json, with the same mapping per message.

Co-authored-by: Isaac <no-reply@databricks.com>
@parthban-db
parthban-db force-pushed the parthban/sdk-go-field-paths branch from 9c36f74 to 6917043 Compare October 30, 2026 18:05
@parthban-db parthban-db changed the title Generate the modular Go SDK's CLI spec in climod with genkit's cli-mod mode Generate the modular Go SDK's field mapping in climod with genkit's cli-mod mode Oct 30, 2026

This branch has not been deployed

No deployments
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