Skip to content

Adopt preferred repository-scoped REST routes - #50

Merged
necolas merged 4 commits into
devfrom
necolas/sdk-rest-routes-additive
Sep 8, 2026
Merged

necolas merged 4 commits into
devfrom
necolas/sdk-rest-routes-additive

Conversation

@necolas

@necolas necolas commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Why

Notion could not use the canonical repository delete route during integration because the docs described that route while the SDK still called a deprecated /api/v1 route. The same integration exposed confusion between a public repository name and an internal repository ID.

Credential operations need a repository name on the canonical repository-scoped route, while the legacy create operation accepts an internal repository ID. Reusing the old field for the new meaning would silently change existing programs.

Scope

  • Move preferred operations to unversioned /api routes and repository-scoped /api/repos/{repo_name} routes.
  • Encode repository names exactly once as one path segment while keeping the raw name in the JWT claim.
  • Add preferred credential repoName options across TypeScript, Python, and Go.
  • Let preferred create calls use repoName and omit repo_id.
  • Preserve the exact legacy create route and body when a caller supplies repoId.
  • Preserve the old update and delete request shape when repoName is absent.
  • Keep apiVersion as an accepted deprecated no-op.
  • Add a route guard that restricts legacy route strings to one compatibility helper per language.
  • Update tests, package documentation, skills, and release notes. This supersedes Adopt canonical unversioned API paths across SDKs #49 without changing the meaning of repoId.

Tradeoffs

  • Legacy credential calls remain available for source compatibility even where the current service rejects the old route.
  • Added Go struct fields can break external unkeyed composite literals. Keyed literals remain compatible.
  • TypeScript uses overloads to preserve the existing interface contract during the migration.

Blast Radius

This changes HTTP routes for preferred calls in all three SDK packages. Legacy credential input keeps its previous wire behavior.

This PR is stacked on #47. Merge #47, retarget this PR to main, and require the main-branch CI result before merge. Package versions and public documentation follow in the release work.

Verification

  • TypeScript: 262 tests, package build, compatibility type compilation, and full-workflow help pass.
  • Python: 199 tests, Ruff checks, Ruff format, and mypy pass.
  • Go: package tests pass.
  • The legacy-route guard and its 13 tests pass.
  • Git diff and secret checks pass.
  • Current GitHub security checks pass.
  • The live workflow was not run because no test cluster or GIT_STORAGE_KEY_PATH was available.

@notion-workspace

Copy link
Copy Markdown

necolas added a commit that referenced this pull request Aug 29, 2026
Keep the named-ref lookup on the latest PR #50 stack. Preserve commit
target-ref options without a deprecation.
Base automatically changed from necolas/sdk-standard-fields-and-params to dev September 8, 2026 18:18
Route preferred SDK calls through the unversioned, repository-scoped API. Keep exact legacy credential requests for deprecated call shapes.

Add repository-name credential options and route coverage across TypeScript, Python, and Go. Keep the API-version options as deprecated no-ops.
Use the normalized repository name when selecting the JWT claim. Preserve the legacy repository ID or organization claim when repoName contains only whitespace.
@necolas
necolas force-pushed the necolas/sdk-rest-routes-additive branch from 66194dd to 6dd2cf1 Compare September 8, 2026 18:22
@necolas
necolas merged commit 7746c5c into dev Sep 8, 2026
2 checks passed
@necolas
necolas deleted the necolas/sdk-rest-routes-additive branch September 8, 2026 18:27
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.

1 participant