Keep each model's parent out of its JSON (closes #177)
check / check (push) Successful in 3m20s
check / check (push) Successful in 3m20s
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:
@@ -34,7 +34,8 @@ type Target struct {
|
||||
MaxRetries int `json:"maxRetries,omitempty"`
|
||||
MaxQueueSize int `json:"maxQueueSize,omitempty"`
|
||||
|
||||
// Relations
|
||||
Webhook Webhook `json:"webhook,omitzero"`
|
||||
// Relations. No model marshals the record it belongs to:
|
||||
// Webhook.Targets leads back here, and the JSON could loop.
|
||||
Webhook Webhook `json:"-"`
|
||||
Deliveries []Delivery `json:"deliveries,omitempty"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user