mirror of
https://github.com/immich-app/immich.git
synced 2024-12-25 10:43:13 +02:00
chore: sort open api spec keys (#2710)
This commit is contained in:
parent
9a3a01ca78
commit
e3694695ae
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,25 @@ export const handleDownload = (download: DownloadArchive, res: Response) => {
|
||||
return download.stream;
|
||||
};
|
||||
|
||||
function sortKeys<T extends object>(obj: T): T {
|
||||
if (!obj) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
const result: Partial<T> = {};
|
||||
const keys = Object.keys(obj).sort() as Array<keyof T>;
|
||||
for (const key of keys) {
|
||||
result[key] = obj[key];
|
||||
}
|
||||
return result as T;
|
||||
}
|
||||
|
||||
const patchOpenAPI = (document: OpenAPIObject) => {
|
||||
document.paths = sortKeys(document.paths);
|
||||
if (document.components?.schemas) {
|
||||
document.components.schemas = sortKeys(document.components.schemas);
|
||||
}
|
||||
|
||||
for (const path of Object.values(document.paths)) {
|
||||
const operations = {
|
||||
get: path.get,
|
||||
|
Loading…
Reference in New Issue
Block a user