1616
1717from contentctl .output .json_writer import JsonWriter
1818
19+ JSON_API_VERSION = 2
20+
1921
2022class ApiJsonOutput :
2123 output_path : pathlib .Path
@@ -70,7 +72,9 @@ def writeDetections(
7072 # del()
7173
7274 JsonWriter .writeJsonObject (
73- os .path .join (self .output_path , "detections.json" ), "detections" , detections
75+ os .path .join (self .output_path , f"detections_v{ JSON_API_VERSION } .json" ),
76+ "detections" ,
77+ detections ,
7478 )
7579
7680 def writeMacros (
@@ -86,7 +90,9 @@ def writeMacros(
8690 if k in macro :
8791 del macro [k ]
8892 JsonWriter .writeJsonObject (
89- os .path .join (self .output_path , "macros.json" ), "macros" , macros
93+ os .path .join (self .output_path , f"macros_v{ JSON_API_VERSION } .json" ),
94+ "macros" ,
95+ macros ,
9096 )
9197
9298 def writeStories (
@@ -132,7 +138,9 @@ def writeStories(
132138 ]
133139
134140 JsonWriter .writeJsonObject (
135- os .path .join (self .output_path , "stories.json" ), "stories" , stories
141+ os .path .join (self .output_path , f"stories_v{ JSON_API_VERSION } .json" ),
142+ "stories" ,
143+ stories ,
136144 )
137145
138146 def writeBaselines (
@@ -163,7 +171,9 @@ def writeBaselines(
163171 ]
164172
165173 JsonWriter .writeJsonObject (
166- os .path .join (self .output_path , "baselines.json" ), "baselines" , baselines
174+ os .path .join (self .output_path , f"baselines_v{ JSON_API_VERSION } .json" ),
175+ "baselines" ,
176+ baselines ,
167177 )
168178
169179 def writeInvestigations (
@@ -195,7 +205,7 @@ def writeInvestigations(
195205 for investigation in objects
196206 ]
197207 JsonWriter .writeJsonObject (
198- os .path .join (self .output_path , "response_tasks .json" ),
208+ os .path .join (self .output_path , f"response_tasks_v { JSON_API_VERSION } .json" ),
199209 "response_tasks" ,
200210 investigations ,
201211 )
@@ -227,7 +237,9 @@ def writeLookups(
227237 if k in lookup :
228238 del lookup [k ]
229239 JsonWriter .writeJsonObject (
230- os .path .join (self .output_path , "lookups.json" ), "lookups" , lookups
240+ os .path .join (self .output_path , f"lookups_v{ JSON_API_VERSION } .json" ),
241+ "lookups" ,
242+ lookups ,
231243 )
232244
233245 def writeDeployments (
@@ -255,7 +267,7 @@ def writeDeployments(
255267 # references are not to be included, but have been deleted in the
256268 # model_serialization logic
257269 JsonWriter .writeJsonObject (
258- os .path .join (self .output_path , "deployments .json" ),
270+ os .path .join (self .output_path , f"deployments_v { JSON_API_VERSION } .json" ),
259271 "deployments" ,
260272 deployments ,
261273 )
0 commit comments