Skip to content

Commit

Permalink
chore(deps): bump jsonapi, update RunTrigger use deprecated relation (#…
Browse files Browse the repository at this point in the history
…1027)

Prerequisite for #1016.

Bumps the jsonapi version to address a bug with interactions between `polyrelation` and deprecated `relation`.

Updates run triggers to backfill the deprecated Sourceable field in the RunTrigger struct.
  • Loading branch information
notchairmk authored Jan 7, 2025
1 parent cec7ba3 commit f215e07
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/hashicorp/go-slug v0.16.0
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/jsonapi v1.3.1
github.com/hashicorp/jsonapi v1.3.2
github.com/stretchr/testify v1.9.0
go.uber.org/mock v0.4.0
golang.org/x/sync v0.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/jsonapi v1.3.1 h1:GtPvnmcWgYwCuDGvYT5VZBHcUyFdq9lSyCzDjn1DdPo=
github.com/hashicorp/jsonapi v1.3.1/go.mod h1:kWfdn49yCjQvbpnvY1dxxAuAFzISwrrMDQOcu6NsFoM=
github.com/hashicorp/jsonapi v1.3.2 h1:gP3fX2ZT7qXi+PbwieptzkspIohO2kCSiBUvUTBAbMs=
github.com/hashicorp/jsonapi v1.3.2/go.mod h1:kWfdn49yCjQvbpnvY1dxxAuAFzISwrrMDQOcu6NsFoM=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
16 changes: 16 additions & 0 deletions run_trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ func (s *runTriggers) List(ctx context.Context, workspaceID string, options *Run
return nil, err
}

for i := range rtl.Items {
backfillDeprecatedSourceable(rtl.Items[i])
}

return rtl, nil
}

Expand All @@ -145,6 +149,8 @@ func (s *runTriggers) Create(ctx context.Context, workspaceID string, options Ru
return nil, err
}

backfillDeprecatedSourceable(rt)

return rt, nil
}

Expand All @@ -166,6 +172,8 @@ func (s *runTriggers) Read(ctx context.Context, runTriggerID string) (*RunTrigge
return nil, err
}

backfillDeprecatedSourceable(rt)

return rt, nil
}

Expand Down Expand Up @@ -203,6 +211,14 @@ func (o *RunTriggerListOptions) valid() error {
return nil
}

func backfillDeprecatedSourceable(runTrigger *RunTrigger) {
if runTrigger.Sourceable != nil || runTrigger.SourceableChoice == nil {
return
}

runTrigger.Sourceable = runTrigger.SourceableChoice.Workspace
}

func validateRunTriggerFilterParam(filterParam RunTriggerFilterOp, includeParams []RunTriggerIncludeOpt) error {
switch filterParam {
case RunTriggerOutbound, RunTriggerInbound:
Expand Down

0 comments on commit f215e07

Please sign in to comment.