feat(functions): replace FunctionRegion enum with open struct#1053
Open
grdsdev wants to merge 1 commit into
Open
feat(functions): replace FunctionRegion enum with open struct#1053grdsdev wants to merge 1 commit into
grdsdev wants to merge 1 commit into
Conversation
- Change `public enum FunctionRegion: String` to `public struct FunctionRegion: RawRepresentable, Hashable, Sendable` - Add `ExpressibleByStringLiteral` conformance - All static members retain identical names (.usEast1, .caCentral1, etc.) - rawValue property is unchanged, so all existing call sites compile - Custom regions now work: FunctionRegion(rawValue: "custom") or "custom" BREAKING: exhaustive switch statements over FunctionRegion no longer compile (add a default: case to fix). Backport of 02b4520 from release/v3.
Contributor
|
spydon
approved these changes
Jul 2, 2026
Coverage Report for CI Build 28606932395Coverage increased (+0.1%) to 81.215%Details
Uncovered Changes
Coverage Regressions6 previously-covered lines in 2 files lost coverage.
Coverage Stats
💛 - Coveralls |
QuintinWillison
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backports the
FunctionRegiontype change fromrelease/v3(part of02b45208).What changed:
public enum FunctionRegion: String→public struct FunctionRegion: RawRepresentable, Hashable, SendablewithExpressibleByStringLiteral.Why: The enum locks users to the 14 hardcoded regions. The struct allows custom values for regions not yet in the SDK:
Migration
No change needed for the vast majority of code —
.usEast1,.caCentral1etc. keep their names,rawValueis unchanged, andFunctionRegion?parameters still accept the same values.One source-breaking case: exhaustive
switchstatements overFunctionRegionno longer compile. Add adefault:case to fix:Test plan
FunctionsClientTestspass unchanged