fix: fixed autoscaling configs in deployments api#214
Conversation
✱ Stainless preview buildsThis PR will update the
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Free Tier Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bugbot Autofix prepared fixes for all 3 issues found in the latest run.
- ✅ Fixed: Missing required
metricfield breaksoneOfvalidation- Added required: [metric] to all three autoscaling schemas and added discriminator with propertyName: metric to both oneOf arrays.
- ✅ Fixed: Autoscaling
oneOfmissing null type despite description- Added type: 'null' as an option in both CreateDeploymentRequest and UpdateDeploymentRequest autoscaling oneOf arrays.
- ✅ Fixed:
custom_metric_namedescribed as required but not enforced- Added required: [metric, custom_metric_name] to CustomMetricAutoscalingConfig schema to enforce the documented requirement.
Or push these changes by commenting:
@cursor push 4131d6c4b1
Preview (4131d6c4b1)
diff --git a/openapi.yaml b/openapi.yaml
--- a/openapi.yaml
+++ b/openapi.yaml
@@ -12198,6 +12198,9 @@
- $ref: '#/components/schemas/HTTPAutoscalingConfig'
- $ref: '#/components/schemas/QueueAutoscalingConfig'
- $ref: '#/components/schemas/CustomMetricAutoscalingConfig'
+ - type: 'null'
+ discriminator:
+ propertyName: metric
command:
description: Command overrides the container's ENTRYPOINT. Provide as an array
(e.g., ["/bin/sh", "-c"])
@@ -12513,6 +12516,8 @@
10'
example: 10
type: integer
+ required:
+ - metric
type: object
QueueAutoscalingConfig:
description: Autoscaling config for QueueBacklogPerWorker metric
@@ -12531,6 +12536,8 @@
description: 'Target is the threshold value. Default: 1.01'
example: 1.01
type: number
+ required:
+ - metric
type: object
CustomMetricAutoscalingConfig:
description: Autoscaling config for CustomMetric metric
@@ -12550,6 +12557,9 @@
description: 'Target is the threshold value. Default: 500'
example: 500
type: number
+ required:
+ - metric
+ - custom_metric_name
type: object
KubernetesEvent:
properties:
@@ -12675,6 +12685,9 @@
- $ref: '#/components/schemas/HTTPAutoscalingConfig'
- $ref: '#/components/schemas/QueueAutoscalingConfig'
- $ref: '#/components/schemas/CustomMetricAutoscalingConfig'
+ - type: 'null'
+ discriminator:
+ propertyName: metric
command:
description: Command overrides the container's ENTRYPOINT. Provide as an array
(e.g., ["/bin/sh", "-c"])| description: 'Target is the threshold value. Default: 500' | ||
| example: 500 | ||
| type: number | ||
| type: object |
There was a problem hiding this comment.
Missing required metric field breaks oneOf validation
High Severity
None of the three new schemas (HTTPAutoscalingConfig, QueueAutoscalingConfig, CustomMetricAutoscalingConfig) mark metric as required, and the oneOf lacks a discriminator. Without required: [metric], a payload like {"target": 100} matches all three schemas, violating the oneOf constraint (exactly one must match) and causing validation to reject valid requests. The existing InterpreterOutput schema in this file demonstrates the correct pattern: using discriminator: propertyName plus required on each sub-schema.
Additional Locations (1)
| oneOf: | ||
| - $ref: '#/components/schemas/HTTPAutoscalingConfig' | ||
| - $ref: '#/components/schemas/QueueAutoscalingConfig' | ||
| - $ref: '#/components/schemas/CustomMetricAutoscalingConfig' |
There was a problem hiding this comment.
Autoscaling oneOf missing null type despite description
Medium Severity
The autoscaling field descriptions in CreateDeploymentRequest and UpdateDeploymentRequest say "set to null to disable autoscaling," but the oneOf doesn't include a null type option. In OpenAPI 3.1.0, null needs to be explicitly allowed (e.g., - type: 'null' in the oneOf list). Without it, sending null for autoscaling will fail validation, contradicting the documented behavior.
Additional Locations (1)
| description: 'Target is the threshold value. Default: 500' | ||
| example: 500 | ||
| type: number | ||
| type: object |
There was a problem hiding this comment.
custom_metric_name described as required but not enforced
Medium Severity
The custom_metric_name property in CustomMetricAutoscalingConfig has a description that explicitly states "Required," but the schema has no required list enforcing it. A client can submit a CustomMetric autoscaling config without custom_metric_name and pass validation, even though the backend presumably needs a Prometheus metric name to function. This mismatch between documented and enforced constraints will lead to confusing server-side errors.



Note
Medium Risk
This changes the published API schema for
autoscaling, which may break existing client code generation or validation that expected a generic key/value object.Overview
Updates the Deployments API OpenAPI contract to replace the
autoscalingfree-form string map with a typedoneOfschema.Adds explicit autoscaling config objects for HTTP, queue-backlog, and custom Prometheus metrics, and clarifies that
autoscalingcan be omitted/null to disable autoscaling (and is omitted in responses when disabled).Written by Cursor Bugbot for commit 4c94683. This will update automatically on new commits. Configure here.