dosubot[bot] commented on issue #7561:
URL: 
https://github.com/apache/incubator-devlake/issues/7561#issuecomment-2145073018

   <!-- Greeting -->
   Hey @yoramshai! 👋 I'm here to help you with any bugs, questions, or 
contributions you have regarding this project. Let's squash those bugs together!
   
   <!-- Answer -->
   The error message you're encountering after upgrading to v1.0.0-beta9 is 
likely due to changes in the `Incident` struct, which introduced new fields 
that might not be handled correctly in your existing codebase. Specifically, 
the following fields were added to the `Incident` struct in v1.0.0-beta9:
   
   - `Priority`
   - `Self`
   - `Service`
   - `Status`
   - `Summary`
   - `Teams`
   - `Title`
   - `Type`
   - `Urgency`
   
   Ensure that your task options are correctly decoded and validated. The 
`PagerDutyOptions` struct and related functions in `task_data.go` should 
properly handle the new fields and any required parameters. Here is an example 
of how the task options are managed:
   
   ```go
   type PagerDutyOptions struct {
        ConnectionId  uint64                       `json:"connectionId" 
mapstructure:"connectionId,omitempty"`
        ServiceId     string                       `json:"serviceId,omitempty" 
mapstructure:"serviceId,omitempty"`
        ServiceName   string                       
`json:"serviceName,omitempty" mapstructure:"serviceName,omitempty"`
        ScopeConfigId uint64                       
`json:"scopeConfigId,omitempty" mapstructure:"scopeConfigId,omitempty"`
        ScopeConfig   *models.PagerdutyScopeConfig 
`json:"service_name,omitempty" mapstructure:"serviceName,omitempty"`
   }
   
   type PagerDutyTaskData struct {
        Options *PagerDutyOptions
        Client  api.RateLimitedApiClient
   }
   
   func DecodeAndValidateTaskOptions(options map[string]interface{}) 
(*PagerDutyOptions, errors.Error) {
        op, err := DecodeTaskOptions(options)
        if err != nil {
                return nil, err
        }
        err = ValidateTaskOptions(op)
        if err != nil {
                return nil, err
        }
        return op, nil
   }
   
   func DecodeTaskOptions(options map[string]interface{}) (*PagerDutyOptions, 
errors.Error) {
        var op PagerDutyOptions
        err := api.Decode(options, &op, nil)
        if err != nil {
                return nil, err
        }
        return &op, nil
   }
   
   func EncodeTaskOptions(op *PagerDutyOptions) (map[string]interface{}, 
errors.Error) {
        var result map[string]interface{}
        err := api.Decode(op, &result, nil)
        if err != nil {
                return nil, err
        }
        return result, nil
   }
   
   func ValidateTaskOptions(op *PagerDutyOptions) errors.Error {
        if op.ServiceName == "" {
                return errors.BadInput.New("not enough info for Pagerduty 
execution")
        }
        if op.ServiceId == "" {
                return errors.BadInput.New("not enough info for Pagerduty 
execution")
        }
        if op.ConnectionId == 0 {
                return errors.BadInput.New("connectionId is invalid")
        }
        return nil
   }
   ```
   
   Ensure that your code handles these new fields appropriately to avoid errors 
<sup>[[1]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/pagerduty/models/raw/incidents.go)</sup><sup>[[2]](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/pagerduty/tasks/task_data.go)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to