mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-11 09:51:30 +00:00
* fix(app): null-safe OAuth2 scope in OpenAPI export (BRU-3297) The OpenAPI exporter calls `.length` on `auth.oauth2.scope` without a null guard. When a user never fills the Scope field for an OAuth2 auth (grant types authorization_code, password, client_credentials), Bruno stores `scope` as `null`, causing the entire export to crash with `TypeError: Cannot read properties of null (reading 'length')`. Replace the unsafe `scope.length > 0` check with a truthy check that handles null, undefined, and empty string uniformly. Emit `scopes` as an empty object when no scope is set — OpenAPI 3.0 requires `scopes` to be present on every OAuth2 flow even when empty. Add 12 jest tests covering all 3 affected grant types. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * style: wrap oauth2 case in block to scope local declarations Addresses Biome `noSwitchDeclarations` — `const` declarations inside a case clause without braces can leak across cases. Pure cosmetic; no behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: drop internal scope-discussion comment in openapi-spec test Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>