feat: add per-function region parameter#641
Conversation
✅ Deploy Preview for open-api ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR extends the API schema and Go models to support per-region configuration for functions and deployments. The Swagger spec gains Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@swagger.yml`:
- Around line 4589-4590: The schemas currently declare region as just "type:
string" and allow override items to omit name/region; tighten these by changing
the region property to a constrained string (e.g., add pattern: "^[A-Z]{3}$" and
minLength/maxLength as appropriate for your airport code format, or an enum if
you have a finite list) and update the override item schemas to mark "name" and
"region" as required; locate and update the occurrences of the region property
and the override item object definitions (the "region" field and the override
items referenced around the other occurrences) to include the pattern/length
constraints and add required: ["name","region"] so malformed payloads are
rejected by validation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d13f8862-abe3-4863-aafa-5c28f4ca7f3f
📒 Files selected for processing (7)
go/models/deploy.gogo/models/deploy_functions_region_overrides_items.gogo/models/function.gogo/models/function_config.gogo/porcelain/deploy.gogo/porcelain/functions_manifest.goswagger.yml
| region: | ||
| type: string |
There was a problem hiding this comment.
Tighten schema validation for region fields and overrides.
region is documented as an airport code, but these fields currently accept any string, and override items allow missing name/region. This weak contract lets malformed payloads pass client-side validation.
🔧 Suggested schema constraints
function:
type: object
properties:
@@
region:
type: string
+ pattern: '^[a-z]{3}$'
+ minLength: 3
+ maxLength: 3
@@
functions_region:
type: string
description: |
The functions region for this deploy as an airport code.
+ pattern: '^[a-z]{3}$'
+ minLength: 3
+ maxLength: 3
functions_region_overrides:
type: array
items:
type: object
+ required:
+ - name
+ - region
properties:
name:
type: string
+ minLength: 1
region:
type: string
+ pattern: '^[a-z]{3}$'
+ minLength: 3
+ maxLength: 3
@@
functionConfig:
type: object
properties:
@@
region:
type: string
+ pattern: '^[a-z]{3}$'
+ minLength: 3
+ maxLength: 3Also applies to: 4694-4709, 5568-5569
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@swagger.yml` around lines 4589 - 4590, The schemas currently declare region
as just "type: string" and allow override items to omit name/region; tighten
these by changing the region property to a constrained string (e.g., add
pattern: "^[A-Z]{3}$" and minLength/maxLength as appropriate for your airport
code format, or an enum if you have a finite list) and update the override item
schemas to mark "name" and "region" as required; locate and update the
occurrences of the region property and the override item object definitions (the
"region" field and the override items referenced around the other occurrences)
to include the pattern/length constraints and add required: ["name","region"] so
malformed payloads are rejected by validation.
🤖 I have created a release *beep* *boop* --- ## [2.54.0](v2.53.0...v2.54.0) (2026-05-18) ### Features * add per-function `region` parameter ([#641](#641)) ([fe659d0](fe659d0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com> Co-authored-by: token-generator-app[bot] <token-generator-app[bot]@users.noreply.github.com>
Goes with https://github.com/netlify/bitballoon/pull/21856.