16
16
17
17
from contentctl .output .json_writer import JsonWriter
18
18
19
+ EXCLUDE_NONE : bool = True
20
+
19
21
20
22
class ApiJsonOutput :
21
23
output_path : pathlib .Path
@@ -51,7 +53,8 @@ def writeDetections(
51
53
"source" ,
52
54
"nes_fields" ,
53
55
]
54
- )
56
+ ),
57
+ exclude_none = EXCLUDE_NONE ,
55
58
)
56
59
for detection in objects
57
60
]
@@ -78,7 +81,10 @@ def writeMacros(
78
81
objects : list [Macro ],
79
82
) -> None :
80
83
macros = [
81
- macro .model_dump (include = set (["definition" , "description" , "name" ]))
84
+ macro .model_dump (
85
+ include = set (["definition" , "description" , "name" ]),
86
+ exclude_none = EXCLUDE_NONE ,
87
+ )
82
88
for macro in objects
83
89
]
84
90
for macro in macros :
@@ -111,7 +117,8 @@ def writeStories(
111
117
"baseline_names" ,
112
118
"detections" ,
113
119
]
114
- )
120
+ ),
121
+ exclude_none = EXCLUDE_NONE ,
115
122
)
116
123
for story in objects
117
124
]
@@ -157,7 +164,8 @@ def writeBaselines(
157
164
"references" ,
158
165
"tags" ,
159
166
]
160
- )
167
+ ),
168
+ exclude_none = EXCLUDE_NONE ,
161
169
)
162
170
for baseline in objects
163
171
]
@@ -190,7 +198,8 @@ def writeInvestigations(
190
198
"tags" ,
191
199
"lowercase_name" ,
192
200
]
193
- )
201
+ ),
202
+ exclude_none = EXCLUDE_NONE ,
194
203
)
195
204
for investigation in objects
196
205
]
@@ -218,7 +227,8 @@ def writeLookups(
218
227
"min_matches" ,
219
228
"case_sensitive_match" ,
220
229
]
221
- )
230
+ ),
231
+ exclude_none = EXCLUDE_NONE ,
222
232
)
223
233
for lookup in objects
224
234
]
@@ -248,7 +258,8 @@ def writeDeployments(
248
258
"rba" ,
249
259
"tags" ,
250
260
]
251
- )
261
+ ),
262
+ exclude_none = EXCLUDE_NONE ,
252
263
)
253
264
for deployment in objects
254
265
]
0 commit comments