Skip to content

Commit 94db182

Browse files
authored
bump to v2 naming schema for
json api objects
1 parent 646f489 commit 94db182

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

contentctl/output/api_json_output.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
from contentctl.output.json_writer import JsonWriter
1818

1919

20+
21+
JSON_API_VERSION = 2
22+
2023
class ApiJsonOutput:
2124
output_path: pathlib.Path
2225
app_label: str
@@ -70,7 +73,7 @@ def writeDetections(
7073
# del()
7174

7275
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
7477
)
7578

7679
def writeMacros(
@@ -86,7 +89,7 @@ def writeMacros(
8689
if k in macro:
8790
del macro[k]
8891
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
9093
)
9194

9295
def writeStories(
@@ -132,7 +135,7 @@ def writeStories(
132135
]
133136

134137
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
136139
)
137140

138141
def writeBaselines(
@@ -163,7 +166,7 @@ def writeBaselines(
163166
]
164167

165168
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
167170
)
168171

169172
def writeInvestigations(
@@ -195,7 +198,7 @@ def writeInvestigations(
195198
for investigation in objects
196199
]
197200
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"),
199202
"response_tasks",
200203
investigations,
201204
)
@@ -227,7 +230,7 @@ def writeLookups(
227230
if k in lookup:
228231
del lookup[k]
229232
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
231234
)
232235

233236
def writeDeployments(
@@ -255,7 +258,7 @@ def writeDeployments(
255258
# references are not to be included, but have been deleted in the
256259
# model_serialization logic
257260
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"),
259262
"deployments",
260263
deployments,
261264
)

0 commit comments

Comments
 (0)