Every reference from a model to the record it belongs to is now json:"-", so the webhook and target models (and the other parent and child pairs in internal/database) can no longer marshal each other in a loop. Preloading maps associations without reading json tags, so it still fills these references; a new test preloads a webhook with its targets and entrypoints and a target with its webhook, checks the references are filled, and checks the marshalled JSON leaves them out. Model: opus-5-5
This commit is contained in:
@@ -56,8 +56,10 @@ type Delivery struct {
|
||||
// the index.
|
||||
FinishedAt *time.Time `gorm:"index:idx_deliveries_status,priority:3" json:"finishedAt,omitempty"`
|
||||
|
||||
// Relations
|
||||
Event Event `json:"event,omitzero"`
|
||||
Target Target `json:"target,omitzero"`
|
||||
// Relations. No model marshals the record it belongs to:
|
||||
// Event.Deliveries and Target.Deliveries lead back here, and the
|
||||
// JSON could loop.
|
||||
Event Event `json:"-"`
|
||||
Target Target `json:"-"`
|
||||
DeliveryResults []DeliveryResult `json:"deliveryResults,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user