Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: feature update api not validating required fields before saving #1527

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 91 additions & 13 deletions api-description/apidocs.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1692,16 +1692,49 @@ definitions:
type: boolean
variations:
$ref: '#/definitions/featureVariationListValue'
description: deprecated
title: Legacy full-replacement fields (deprecated)
prerequisites:
$ref: '#/definitions/featurePrerequisiteListValue'
description: deprecated
targets:
$ref: '#/definitions/featureTargetListValue'
description: deprecated
rules:
$ref: '#/definitions/featureRuleListValue'
description: deprecated
defaultStrategy:
$ref: '#/definitions/featureStrategy'
offVariation:
type: string
resetSamplingSeed:
type: boolean
variationChanges:
type: array
items:
type: object
$ref: '#/definitions/featureVariationChange'
title: New granular change fields (supporting multiple operations per field)
ruleChanges:
type: array
items:
type: object
$ref: '#/definitions/featureRuleChange'
prerequisiteChanges:
type: array
items:
type: object
$ref: '#/definitions/featurePrerequisiteChange'
targetChanges:
type: array
items:
type: object
$ref: '#/definitions/featureTargetChange'
tagChanges:
type: array
items:
type: object
$ref: '#/definitions/featureTagChange'
GatewayUpdatePushBody:
type: object
properties:
Expand Down Expand Up @@ -2315,6 +2348,14 @@ definitions:
featureFlagCount:
type: integer
format: int32
featureChangeType:
type: string
enum:
- UNSPECIFIED
- CREATE
- UPDATE
- DELETE
default: UNSPECIFIED
featureClause:
type: object
properties:
Expand Down Expand Up @@ -2415,11 +2456,6 @@ definitions:
$ref: '#/definitions/featurePrerequisite'
samplingSeed:
type: string
scheduleUpdate:
type: array
items:
type: object
$ref: '#/definitions/featureScheduleUpdate'
featureFeatureLastUsedInfo:
type: object
properties:
Expand Down Expand Up @@ -2466,6 +2502,16 @@ definitions:
type: string
variationId:
type: string
featurePrerequisiteChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
prerequisite:
$ref: '#/definitions/featurePrerequisite'
required:
- changeType
- prerequisite
featurePrerequisiteListValue:
type: object
properties:
Expand Down Expand Up @@ -2525,6 +2571,16 @@ definitions:
items:
type: object
$ref: '#/definitions/featureClause'
featureRuleChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
rule:
$ref: '#/definitions/featureRule'
required:
- changeType
- rule
featureRuleListValue:
type: object
properties:
Expand All @@ -2533,14 +2589,6 @@ definitions:
items:
type: object
$ref: '#/definitions/featureRule'
featureScheduleUpdate:
type: object
properties:
feature:
$ref: '#/definitions/featureFeature'
updateAt:
type: string
format: int64
featureSegmentUser:
type: object
properties:
Expand Down Expand Up @@ -2588,6 +2636,16 @@ definitions:
- FIXED
- ROLLOUT
default: FIXED
featureTagChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
tag:
type: string
required:
- changeType
- tag
featureTarget:
type: object
properties:
Expand All @@ -2597,6 +2655,16 @@ definitions:
type: array
items:
type: string
featureTargetChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
target:
$ref: '#/definitions/featureTarget'
required:
- changeType
- target
featureTargetListValue:
type: object
properties:
Expand Down Expand Up @@ -2631,6 +2699,16 @@ definitions:
- PARTIAL
- FULL
default: QUEUED
featureVariationChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
variation:
$ref: '#/definitions/bucketeerfeatureVariation'
required:
- changeType
- variation
featureVariationListValue:
type: object
properties:
Expand Down
79 changes: 58 additions & 21 deletions api-description/web-api.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8076,6 +8076,14 @@ definitions:
properties:
description:
type: string
featureChangeType:
type: string
enum:
- UNSPECIFIED
- CREATE
- UPDATE
- DELETE
default: UNSPECIFIED
featureClauseOperator:
type: string
enum:
Expand Down Expand Up @@ -8314,11 +8322,6 @@ definitions:
$ref: '#/definitions/featurePrerequisite'
samplingSeed:
type: string
scheduleUpdate:
type: array
items:
type: object
$ref: '#/definitions/featureScheduleUpdate'
featureFeatureLastUsedInfo:
type: object
properties:
Expand Down Expand Up @@ -8522,6 +8525,16 @@ definitions:
type: string
variationId:
type: string
featurePrerequisiteChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
prerequisite:
$ref: '#/definitions/featurePrerequisite'
required:
- changeType
- prerequisite
featurePrerequisiteListValue:
type: object
properties:
Expand Down Expand Up @@ -8600,6 +8613,16 @@ definitions:
items:
type: object
$ref: '#/definitions/bucketeerfeatureClause'
featureRuleChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
rule:
$ref: '#/definitions/featureRule'
required:
- changeType
- rule
featureRuleListValue:
type: object
properties:
Expand All @@ -8608,22 +8631,6 @@ definitions:
items:
type: object
$ref: '#/definitions/featureRule'
featureScheduleUpdate:
type: object
properties:
feature:
$ref: '#/definitions/featureFeature'
updateAt:
type: string
format: int64
featureScheduleUpdateListValue:
type: object
properties:
value:
type: array
items:
type: object
$ref: '#/definitions/featureScheduleUpdate'
featureSegment:
type: object
properties:
Expand Down Expand Up @@ -8707,6 +8714,16 @@ definitions:
- FIXED
- ROLLOUT
default: FIXED
featureTagChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
tag:
type: string
required:
- changeType
- tag
featureTarget:
type: object
properties:
Expand All @@ -8716,6 +8733,16 @@ definitions:
type: array
items:
type: string
featureTargetChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
target:
$ref: '#/definitions/featureTarget'
required:
- changeType
- target
featureTargetListValue:
type: object
properties:
Expand Down Expand Up @@ -8784,6 +8811,16 @@ definitions:
type: string
forceUpdate:
type: boolean
featureVariationChange:
type: object
properties:
changeType:
$ref: '#/definitions/featureChangeType'
variation:
$ref: '#/definitions/bucketeerfeatureVariation'
required:
- changeType
- variation
featureVariationListValue:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion manifests/bucketeer/charts/api/values.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions manifests/bucketeer/charts/web/values.yaml

Large diffs are not rendered by default.

19 changes: 15 additions & 4 deletions pkg/autoops/api/progressive_rollout.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,23 @@ func (s *AutoOpsService) ExecuteProgressiveRollout(
return err
}
updated, err := feature.Update(
nil, nil, nil,
nil, // name
nil, // description
nil, // tags
enabled,
nil, nil, nil, nil, nil,
nil, // archived
defaultStrategy,
nil,
false,
nil, // offVariation
false, // resetSamplingSeed
nil, // prerequisites
nil, // targets
nil, // rules
nil, // variations
nil, // prerequisiteChanges
nil, // targetChanges
nil, // ruleChanges
nil, // variationChanges
nil, // tagChanges
)
if err != nil {
return err
Expand Down
13 changes: 9 additions & 4 deletions pkg/feature/api/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,18 @@ func (s *FeatureService) UpdateFeature(
req.Tags,
req.Enabled,
req.Archived,
req.Variations,
req.Prerequisites,
req.Targets,
req.Rules,
req.DefaultStrategy,
req.OffVariation,
req.ResetSamplingSeed,
req.Prerequisites,
req.Targets,
req.Rules,
req.Variations,
req.PrerequisiteChanges,
req.TargetChanges,
req.RuleChanges,
req.VariationChanges,
req.TagChanges,
)
if err != nil {
return err
Expand Down
Loading
Loading