mirror of
https://github.com/Casvt/MIND.git
synced 2026-02-19 11:54:46 -05:00
Fixed error linking in API doc generation script
This commit is contained in:
@@ -21,6 +21,15 @@ url_var_map = {
|
||||
'int:s_id': ReminderNotFound
|
||||
}
|
||||
|
||||
def make_exception_instance(cls: Exception) -> Exception:
|
||||
try:
|
||||
return cls()
|
||||
except TypeError:
|
||||
try:
|
||||
return cls('1')
|
||||
except TypeError:
|
||||
return cls('1', '2')
|
||||
|
||||
result = f"""# API
|
||||
Below is the API documentation. Report an issue on [GitHub](https://github.com/Casvt/MIND/issues).
|
||||
|
||||
@@ -112,7 +121,7 @@ Replace `<{url_var}>` with the ID of the entry. For example: `{rule.replace(f'<{
|
||||
url_exception = [url_var_map[url_var]] if url_var in url_var_map else []
|
||||
variable_exceptions = [e for v in data['input_variables'].get(method, []) for e in v.related_exceptions]
|
||||
related_exceptions = sorted(
|
||||
(e() for e in set(variable_exceptions + url_exception)),
|
||||
(make_exception_instance(e) for e in set(variable_exceptions + url_exception)),
|
||||
key=lambda e: (e.api_response['code'], e.api_response['error'])
|
||||
)
|
||||
for related_exception in related_exceptions:
|
||||
@@ -130,9 +139,9 @@ else:
|
||||
with open(folder_path('docs', 'api.md'), 'w+') as f:
|
||||
f.write(result)
|
||||
|
||||
run(["git", "config", "--global", "user.email", '"casvantijn@gmail.com"'])
|
||||
run(["git", "config", "--global", "user.name", '"CasVT"'])
|
||||
run(["git", "checkout", "Development"])
|
||||
run(["git", "add", folder_path('docs', 'api.md')])
|
||||
run(["git", "commit", "-m", "Updated API docs"])
|
||||
run(["git", "push"])
|
||||
# run(["git", "config", "--global", "user.email", '"casvantijn@gmail.com"'])
|
||||
# run(["git", "config", "--global", "user.name", '"CasVT"'])
|
||||
# run(["git", "checkout", "Development"])
|
||||
# run(["git", "add", folder_path('docs', 'api.md')])
|
||||
# run(["git", "commit", "-m", "Updated API docs"])
|
||||
# run(["git", "push"])
|
||||
|
||||
Reference in New Issue
Block a user