Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go",
"image": "mcr.microsoft.com/devcontainers/go:1-1.22-bullseye",
"image": "mcr.microsoft.com/devcontainers/go:1-1.25-bookworm",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
Expand Down
4,759 changes: 4,223 additions & 536 deletions .speakeasy/gen.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ generation:
skipResponseBodyAssertions: false
preApplyUnionDiscriminators: true
go:
version: 0.4.1
version: 0.5.0
additionalDependencies: {}
baseErrorName: OpenRouterError
clientServerStatusCodesAsErrors: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] maxMethodParams: 4 is the root cause of the recurring breaking-signature churn on regens β€” set it to 0

Details

Why: With maxMethodParams: 4 (and methodArguments: infer-optional-args), Speakeasy flattens operation parameters into positional Go args placed after ctx and before the request object. So whenever the spec adds a header or query param to an operation that has ≀4 params, the method signature shifts and existing callers break at compile time. That's exactly what happened this round:

  • Chat.Send(ctx, chatRequest, xOpenRouterMetadata *MetadataLevel, opts...) β€” new positional xOpenRouterMetadata
  • Responses.Send(ctx, responsesRequest, xOpenRouterMetadata *MetadataLevel, opts...) β€” same
  • Models.List(ctx, category, supportedParameters, outputModalities, sort *Sort, opts...) β€” new positional sort

These specific changes are intentional/spec-driven, but the pattern will keep breaking consumers on every future spec change. Setting maxMethodParams: 0 forces every operation to take a single request struct, so new optional params become new struct fields (additive, non-breaking) instead of new positional args.

Fix (in .speakeasy/gen.yaml, go: section):

  maxMethodParams: 0

This is a one-time signature change for all operations (itself breaking, so pair it with the next version bump), after which param additions stop breaking callers.

Ref: Speakeasy Go config β€” maxMethodParams Β· Handling breaking changes in SDKs

Prompt for agents
In `.speakeasy/gen.yaml`, under the `go:` section, change `maxMethodParams: 4` to `maxMethodParams: 0`. This forces Speakeasy to generate a single request-object parameter for every operation instead of flattening params into positional Go arguments. The effect: future spec additions of optional headers/query params (like the xOpenRouterMetadata header and Models.List sort param added in this regen) become additive struct fields rather than breaking positional-argument signature changes. Note this is itself a one-time breaking signature change across all operations, so land it together with a deliberate version bump and update USAGE.md/README examples accordingly. Regenerate the SDK after the config change.

Reviewed at 12cc087

Expand Down
Loading