|
1 | 1 | package model |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "encoding/json" |
5 | 4 | "fmt" |
6 | 5 |
|
7 | 6 | "github.com/keboola/go-utils/pkg/orderedmap" |
8 | | - "github.com/keboola/keboola-sdk-go/v2/pkg/keboola" |
9 | 7 |
|
10 | 8 | "github.com/keboola/keboola-as-code/internal/pkg/filesystem" |
11 | 9 | "github.com/keboola/keboola-as-code/internal/pkg/utils/errors" |
@@ -91,44 +89,11 @@ type ConfigRowManifest struct { |
91 | 89 | Relations Relations `json:"relations,omitempty" validate:"dive"` // relations with other objects, for example variables values definition |
92 | 90 | } |
93 | 91 |
|
94 | | -type NotificationManifestRef struct { |
95 | | - ID keboola.NotificationSubscriptionID `json:"id"` |
96 | | - Path string `json:"path,omitempty"` |
97 | | -} |
98 | | - |
99 | 92 | type ConfigManifestWithRows struct { |
100 | 93 | ConfigManifest |
101 | 94 | Rows []*ConfigRowManifest `json:"rows"` |
102 | 95 | } |
103 | 96 |
|
104 | | -// MarshalJSON implements custom JSON marshaling to simplify notifications to just IDs. |
105 | | -func (c *ConfigManifestWithRows) MarshalJSON() ([]byte, error) { |
106 | | - // Convert notifications to simplified refs |
107 | | - notificationRefs := make([]*NotificationManifestRef, 0, len(c.Notifications)) |
108 | | - for _, n := range c.Notifications { |
109 | | - if n != nil { |
110 | | - notificationRefs = append(notificationRefs, &NotificationManifestRef{ID: n.ID, Path: n.GetRelativePath()}) |
111 | | - } |
112 | | - } |
113 | | - |
114 | | - // Create a copy with simplified notifications |
115 | | - return json.Marshal(&struct { |
116 | | - ConfigKey |
117 | | - Paths |
118 | | - Relations Relations `json:"relations,omitempty"` |
119 | | - Metadata *orderedmap.OrderedMap `json:"metadata,omitempty"` |
120 | | - Rows []*ConfigRowManifest `json:"rows"` |
121 | | - Notifications []*NotificationManifestRef `json:"notifications,omitempty"` |
122 | | - }{ |
123 | | - ConfigKey: c.ConfigKey, |
124 | | - Paths: c.Paths, |
125 | | - Relations: c.Relations, |
126 | | - Metadata: c.Metadata, |
127 | | - Rows: c.Rows, |
128 | | - Notifications: notificationRefs, |
129 | | - }) |
130 | | -} |
131 | | - |
132 | 97 | func (p *Paths) ClearRelatedPaths() { |
133 | 98 | p.RelatedPaths = make([]string, 0) |
134 | 99 | } |
|
0 commit comments