17
17
from contentctl .output .json_writer import JsonWriter
18
18
19
19
20
+
21
+ JSON_API_VERSION = 2
22
+
20
23
class ApiJsonOutput :
21
24
output_path : pathlib .Path
22
25
app_label : str
@@ -70,7 +73,7 @@ def writeDetections(
70
73
# del()
71
74
72
75
JsonWriter .writeJsonObject (
73
- os .path .join (self .output_path , "detections .json" ), "detections" , detections
76
+ os .path .join (self .output_path , f"detections_v { JSON_API_VERSION } .json" ), "detections" , detections
74
77
)
75
78
76
79
def writeMacros (
@@ -86,7 +89,7 @@ def writeMacros(
86
89
if k in macro :
87
90
del macro [k ]
88
91
JsonWriter .writeJsonObject (
89
- os .path .join (self .output_path , "macros .json" ), "macros" , macros
92
+ os .path .join (self .output_path , f"macros_v { JSON_API_VERSION } .json" ), "macros" , macros
90
93
)
91
94
92
95
def writeStories (
@@ -132,7 +135,7 @@ def writeStories(
132
135
]
133
136
134
137
JsonWriter .writeJsonObject (
135
- os .path .join (self .output_path , "stories .json" ), "stories" , stories
138
+ os .path .join (self .output_path , f"stories_v { JSON_API_VERSION } .json" ), "stories" , stories
136
139
)
137
140
138
141
def writeBaselines (
@@ -163,7 +166,7 @@ def writeBaselines(
163
166
]
164
167
165
168
JsonWriter .writeJsonObject (
166
- os .path .join (self .output_path , "baselines .json" ), "baselines" , baselines
169
+ os .path .join (self .output_path , f"baselines_v { JSON_API_VERSION } .json" ), "baselines" , baselines
167
170
)
168
171
169
172
def writeInvestigations (
@@ -195,7 +198,7 @@ def writeInvestigations(
195
198
for investigation in objects
196
199
]
197
200
JsonWriter .writeJsonObject (
198
- os .path .join (self .output_path , "response_tasks .json" ),
201
+ os .path .join (self .output_path , f"response_tasks_v { JSON_API_VERSION } .json" ),
199
202
"response_tasks" ,
200
203
investigations ,
201
204
)
@@ -227,7 +230,7 @@ def writeLookups(
227
230
if k in lookup :
228
231
del lookup [k ]
229
232
JsonWriter .writeJsonObject (
230
- os .path .join (self .output_path , "lookups .json" ), "lookups" , lookups
233
+ os .path .join (self .output_path , f"lookups_v { JSON_API_VERSION } .json" ), "lookups" , lookups
231
234
)
232
235
233
236
def writeDeployments (
@@ -255,7 +258,7 @@ def writeDeployments(
255
258
# references are not to be included, but have been deleted in the
256
259
# model_serialization logic
257
260
JsonWriter .writeJsonObject (
258
- os .path .join (self .output_path , "deployments .json" ),
261
+ os .path .join (self .output_path , f"deployments_v { JSON_API_VERSION } .json" ),
259
262
"deployments" ,
260
263
deployments ,
261
264
)
0 commit comments