Skip to content

fix(openapi): preserve typed default errors - #2002

Merged
flemzord merged 1 commit into
mainfrom
fix/openapi-typed-error-responses
Aug 6, 2026
Merged

fix(openapi): preserve typed default errors#2002
flemzord merged 1 commit into
mainfrom
fix/openapi-typed-error-responses

Conversation

@flemzord

@flemzord flemzord commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • keep the global Speakeasy error policy on default only
  • prevent generic 4XX/5XX matchers from shadowing typed default error schemas in generated SDKs
  • update the OpenAPI build invariant to reject a reintroduction of range matchers

Root cause

The 4XX and 5XX matchers introduced in v3.2.9 run before each operation's typed default error response in generated SDKs. Structured API errors are therefore converted into generic SDK errors, and explicit error statuses can disappear from generated response models.

Validation

  • nix develop --impure --command bash -c 'just generate-composition-overlay && speakeasy run -s all --skip-upload-spec --auto-yes && just validate-openapi'
  • OpenAPI lint: 0 errors
  • generated policy: ["default"]
  • normalized v3.2.9 and candidate documents are byte-identical after removing paths.x-speakeasy-errors (ac36525febc56af5e96654b57a70824625137631053f19c71481375364681b3e)
  • git diff --check

Release

This is intended for Stack v3.2.10. SDKs should regenerate from the v3.2.10 Registry revision before any generated PR is merged.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9f07ef39-4860-4ebc-bb46-b240e9cd3f25

📥 Commits

Reviewing files that changed from the base of the PR and between 5eeed11 and ea49852.

⛔ Files ignored due to path filters (1)
  • releases/overlays/shared.overlay.yaml is excluded by !**/*.yaml
📒 Files selected for processing (1)
  • Justfile

Walkthrough

The validate-openapi target now requires the generated error path to expose only the "default" response status code.

Changes

OpenAPI validation

Layer / File(s) Summary
Validate default error response
Justfile
The OpenAPI validation assertion now requires only the typed "default" error response instead of "4XX", "5XX", and "default" responses.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: gfyrag

Poem

A rabbit checks the schema bright,
Finds one default response right.
The extra codes now fade away,
Validation hops through clean today.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states that the OpenAPI change preserves typed default errors.
Description check ✅ Passed The description directly explains the OpenAPI error-handling change, root cause, validation, and release impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/openapi-typed-error-responses

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NumaryBot

Copy link
Copy Markdown

✅ Approve — automated review

The change consistently limits the global Speakeasy error policy to default and updates the validation invariant accordingly. No regressions or actionable defects were found.

No findings.

@flemzord
flemzord merged commit 892837f into main Aug 6, 2026
4 checks passed
@flemzord
flemzord deleted the fix/openapi-typed-error-responses branch August 6, 2026 14:54
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.

2 participants