Skip to content

Replace instance with serverURL in generated code samples#90

Draft
chris-freeman-glean wants to merge 1 commit intomainfrom
cfreeman/server-url-code-samples
Draft

Replace instance with serverURL in generated code samples#90
chris-freeman-glean wants to merge 1 commit intomainfrom
cfreeman/server-url-code-samples

Conversation

@chris-freeman-glean
Copy link
Contributor

Summary

Migrates generated code samples from using instance to serverURL as the primary configuration parameter. This is part of a broader effort to promote serverURL as the primary way users configure their Glean SDK, replacing the instance concept in all documentation and examples.

What changed

  • Renamed addInstanceToCodeSamplesaddServerURLToCodeSamples in src/code-sample-transformer.js
  • Updated regex transformations for all 4 languages (Python, TypeScript, Go, Java) to inject serverURL instead of instance configuration
  • Updated all test snapshots

Why this goes first

This change must land before Speakeasy SDK regeneration (Phase 3) so that regenerated READMEs automatically use serverURL in their code samples.

Language-specific code sample changes

Language Before After
Python instance=os.environ.get("GLEAN_INSTANCE") server_url="mycompany-be.glean.com"
TypeScript instance: process.env["GLEAN_INSTANCE"] serverURL: "mycompany-be.glean.com"
Go apiclientgo.WithInstance(os.Getenv("GLEAN_INSTANCE")) apiclientgo.WithServerURL("mycompany-be.glean.com")
Java .instance("<value>") .serverURL("mycompany-be.glean.com")

Backwards compatibility

The instance parameter remains in the generated SDK code (from the OpenAPI spec transformer). This change only affects documentation/examples — no breaking changes.

Test plan

  • All 54 existing tests pass with updated snapshots

Update code sample transformer to use hardcoded serverURL values
instead of instance environment variables across Python, TypeScript,
Go, and Java code samples.
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