Skip to content

Commit 1bd5a0c

Browse files
committed
Add omitempty to fields not present in default flogo.json
1 parent 410bd8d commit 1bd5a0c

5 files changed

Lines changed: 25 additions & 49 deletions

File tree

action/config.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import "encoding/json"
55
// Config is the configuration for the Action
66
type Config struct {
77
//inline action
8-
Ref string `json:"ref"`
9-
Type string `json:"type"` //an alias to the ref, can be used if imported
10-
Settings map[string]interface{} `json:"settings"`
8+
Ref string `json:"ref,omitempty"`
9+
Type string `json:"type,omitempty"` //an alias to the ref, can be used if imported
10+
Settings map[string]interface{} `json:"settings,omitempty"`
1111

1212
//referenced action
13-
Id string `json:"id"`
13+
Id string `json:"id,omitempty"`
1414

1515
//DEPRECATED
16-
Data json.RawMessage `json:"data"`
16+
Data json.RawMessage `json:"data,omitempty"`
1717
}

app/config.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ type Config struct {
1313
Type string `json:"type"`
1414
Version string `json:"version"`
1515
Description string `json:"description"`
16+
AppModel string `json:"appModel"`
1617

17-
Imports []string `json:"imports"`
18-
Properties []*data.Attribute `json:"properties"`
19-
Channels []string `json:"channels"`
20-
Triggers []*trigger.Config `json:"triggers"`
21-
Resources []*resource.Config `json:"resources"`
22-
Actions []*action.Config `json:"actions"`
18+
Imports []string `json:"imports,omitempty"`
19+
Properties []*data.Attribute `json:"properties,omitempty"`
20+
Channels []string `json:"channels,omitempty"`
21+
Triggers []*trigger.Config `json:"triggers,omitempty"`
22+
Resources []*resource.Config `json:"resources,omitempty"`
23+
Actions []*action.Config `json:"actions,omitempty"`
2324
}

internal/schema/assets.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/schema/schema.json

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55
"type",
66
"version",
77
"description",
8-
"imports",
9-
"properties",
10-
"channels",
11-
"triggers",
12-
"resources",
13-
"actions"
8+
"appModel"
149
],
1510
"properties": {
1611
"actions": {
@@ -20,6 +15,9 @@
2015
},
2116
"type": "array"
2217
},
18+
"appModel": {
19+
"type": "string"
20+
},
2321
"channels": {
2422
"items": {
2523
"type": "string"
@@ -75,12 +73,7 @@
7573
"type",
7674
"version",
7775
"description",
78-
"imports",
79-
"properties",
80-
"channels",
81-
"triggers",
82-
"resources",
83-
"actions"
76+
"appModel"
8477
],
8578
"properties": {
8679
"actions": {
@@ -90,6 +83,9 @@
9083
},
9184
"type": "array"
9285
},
86+
"appModel": {
87+
"type": "string"
88+
},
9389
"channels": {
9490
"items": {
9591
"type": "string"
@@ -140,13 +136,6 @@
140136
"type": "object"
141137
},
142138
"action.Config": {
143-
"required": [
144-
"ref",
145-
"type",
146-
"settings",
147-
"id",
148-
"data"
149-
],
150139
"properties": {
151140
"data": {
152141
"type": "object"
@@ -188,19 +177,7 @@
188177
"type": "object"
189178
},
190179
"trigger.ActionConfig": {
191-
"required": [
192-
"ref",
193-
"type",
194-
"settings",
195-
"id",
196-
"data",
197-
"Act"
198-
],
199180
"properties": {
200-
"Act": {
201-
"additionalProperties": true,
202-
"type": "object"
203-
},
204181
"data": {
205182
"type": "object"
206183
},
@@ -232,8 +209,6 @@
232209
"trigger.Config": {
233210
"required": [
234211
"id",
235-
"type",
236-
"ref",
237212
"settings",
238213
"handlers"
239214
],

trigger/config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
// Config is the configuration for a Trigger
1313
type Config struct {
1414
Id string `json:"id"`
15-
Type string `json:"type"` //an alias to the ref, can be used if imported
16-
Ref string `json:"ref"`
15+
Type string `json:"type,omitempty"` //an alias to the ref, can be used if imported
16+
Ref string `json:"ref,omitempty"`
1717
Settings map[string]interface{} `json:"settings"`
1818
Handlers []*HandlerConfig `json:"handlers"`
1919
}
@@ -94,7 +94,7 @@ type ActionConfig struct {
9494
Input map[string]interface{} `json:"input,omitempty"`
9595
Output map[string]interface{} `json:"output,omitempty"`
9696

97-
Act action.Action
97+
Act action.Action `json:"-,omitempty"`
9898
}
9999

100100
// UnmarshalJSON overrides the default UnmarshalJSON for TaskInst

0 commit comments

Comments
 (0)