Skip to content

Escape string path parameters by segment type - #1811

Closed
renaudhartert-db wants to merge 2 commits into
databricks:mainfrom
renaudhartert-db:fix/path-parameter-serialization
Closed

renaudhartert-db wants to merge 2 commits into
databricks:mainfrom
renaudhartert-db:fix/path-parameter-serialization

Conversation

@renaudhartert-db

@renaudhartert-db renaudhartert-db commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Percent-encodes generated string path parameters according to their OpenAPI segment semantics. Ordinary values occupy one URL segment, while explicit and patterned multi-segment resource names preserve / separators and escape each segment independently.

Why

Generated clients previously interpolated most string path parameters directly into request paths. Reserved characters such as /, #, ?, and spaces could therefore change the URL structure or route requests to the wrong endpoint.

Treating every string as a single segment is also incorrect: hierarchical resource names such as projects/p1 and projects/p1/branches/b1 rely on / separators to match their routes. This PR uses the generator's segment metadata, including resource patterns fixed by universe#2437239, to distinguish those cases.

What changed

Interface changes

  • Adds httpclient.EncodeSingleSegmentPathParameter(string) string for values that must remain within one URL path segment.
  • Documents the existing httpclient.EncodeMultiSegmentPathParameter behavior.

Behavioral changes

  • Generated string and configured account ID path parameters are percent-encoded as single segments by default; embedded / characters become %2F.
  • Explicit multi-segment parameters and patterned resource bindings such as {parent=projects/*} preserve / as hierarchy separators while escaping each segment.
  • Numeric and boolean path parameters are unchanged.

Internal changes

  • Regenerates affected API implementations and generated test services.
  • Removes governed-tag escaping overrides now covered by generated single-segment serialization; retaining them would double-encode the path value.
  • Updates long-running-operation fixtures to expect escaped operation names.

How is this tested?

  • make fmt
  • make test (1,493 tests passed)
  • make lint
  • bazel test //openapi/genkit/apimodel:apimodel_test //openapi/genkit/rendering/gobeta:gobeta_test --tool_tag=ai-agent --test_output=errors --noshow_progress --noshow_loading_progress
  • Audited the pinned OpenAPI resource patterns against generated SDK paths to verify hierarchical bindings use multi-segment encoding and constant/* bindings remain single-segment.

Signed-off-by: Renaud Hartert <renaud.hartert@databricks.com>
Signed-off-by: Renaud Hartert <renaud.hartert@databricks.com>
@renaudhartert-db
renaudhartert-db deployed to test-trigger-is August 17, 2026 19:51 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-go

Inputs:

  • PR number: 1811
  • Commit SHA: 7908fd21fea49c808201689d9767753a25baf3d5

Checks will be approved automatically on success.

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 15 days if no further activity occurs. If this PR is still relevant, please leave a comment or push new changes to keep it open. Thank you for your contributions.

@github-actions github-actions Bot added the stale The PR has been marked as "stale" and will automatically be closed if no further activity. label Sep 17, 2026
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

This pull request has been automatically closed because it remained stale for 15 days with no further activity. Feel free to reopen it if you'd like to continue working on it.

@github-actions github-actions Bot closed this Oct 2, 2026

This branch was successfully deployed

1 active deployment
test-trigger-is — 7908fd21 Deployed Aug 17, 2026 by renaudhartert-db via Check secrets access #2190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale The PR has been marked as "stale" and will automatically be closed if no further activity.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant