Skip to content

Commit

Permalink
chore: endpoints.jsonに保存しないように
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Nov 29, 2023
1 parent f627275 commit 49132de
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions compiler/endpoints.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import os

from type import OpenAPI

Expand All @@ -22,23 +21,6 @@
PATHS.append(f"{PREFIX}{path}")


old_endpoints = []
if os.path.exists("./datas/endpoints.json"):
with open("./datas/endpoints.json", mode="r", encoding="utf-8") as f:
old_endpoints = json.load(f)

with open("./datas/endpoints.json", mode="w", encoding="utf-8") as f:
removed_endpoints = []
for i in old_endpoints:
if i not in list(dict.fromkeys(PATHS)):
removed_endpoints.append(i)
with open("./datas/removed-endpoints.json", mode="w", encoding="utf-8") as removed_endpoints_f:
json.dump(removed_endpoints, removed_endpoints_f, ensure_ascii=False, indent=4)

old_endpoints.extend(PATHS)
old_endpoints = list(dict.fromkeys(old_endpoints))
json.dump(old_endpoints, f, ensure_ascii=False, indent=4)

with open("../mipac/types/endpoints.py", "w", encoding="utf-8") as f:
data = json.dumps(old_endpoints, ensure_ascii=False, indent=4)
data = json.dumps(PATHS, ensure_ascii=False, indent=4)
f.write(f"{TOP_COMMENT}{IMPORTS}{TEMPLATES}Literal{data}\n")

0 comments on commit 49132de

Please sign in to comment.