Skip to content

Make request optional when it has no required fields (fixes request={}) - #125

Open
jfriedr wants to merge 1 commit into
mainfrom
fix/optional-empty-request
Open

jfriedr wants to merge 1 commit into
mainfrom
fix/optional-empty-request

Conversation

@jfriedr

@jfriedr jfriedr commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Switches python.methodArguments in .speakeasy/gen.yaml from require-security-and-request to infer-optional-args (the setting the C# SDK already uses).
  • Updates MIGRATION.md: the "known issue" about request={} becomes a note that it's optional from 5.0.0b3.

Why

In 5.0.0b1/b2, methods whose only parameter is the hidden SHIPPO-API-VERSION global get an empty but required request model, so these fail without request={}:
service_groups.list, refunds.list, user_parcel_templates.list, rates_at_checkout.get_default_parcel_template, rates_at_checkout.delete_default_parcel_template. MIGRATION.md promised to fix this before 5.0.0.

Effect (verified with a local speakeasy generate from this config)

Only 8 methods change (sync + async), and each change just adds a default, e.g.:

-        ],
+        ] = operations.ListServiceGroupsRequest(),

Affected: the 5 above plus carrier_accounts.list, orders.list, shipments.list, transactions.list (which only have optional filters). No other signature changes; passing request=... keeps working, so this is backwards compatible.

Testing (local regen against the test account)

  • Existing suite: 17/17 passed.
  • Live calls with no arguments succeeded: service_groups.list(), refunds.list(), carrier_accounts.list(), shipments.list(), orders.list(), transactions.list(), rates_at_checkout.get_default_parcel_template(); service_groups.list(request={}) still works.
  • Separate, pre-existing issue found: user_parcel_templates.list() fails response validation because the API returns object_created as 2024-03-20 15:42:59.798846 +0000 UTC (not ISO 8601). 3.9.0 fails on the same response, so it is not a regression; it needs an API-side fix.

After merge

Not a publish trigger (no RELEASES.md change). The next Generate regenerates with this config as 5.0.0-beta.3.

🤖 Generated with Claude Code

With methodArguments: require-security-and-request, operations whose only
parameter is the hidden SHIPPO-API-VERSION global (service_groups.list,
refunds.list, user_parcel_templates.list, get/delete_default_parcel_template)
generate an empty but required request model, so callers must pass request={}.
infer-optional-args (already used by the C# SDK) gives such requests a default.
It only adds defaults; existing calls keep working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jfriedr
jfriedr requested review from a team as code owners October 27, 2026 17:43
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
Tests Skipped Failures Errors Time
17 0 💤 0 ❌ 0 🔥 21.882 ⏱

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