chore: sort open api spec keys (#2710)

This commit is contained in:
Jason Rasmussen authored and GitHub committed 2023-06-09 23:14:18 -05:00
1 parent 9a3a01ca78
commit e3694695ae
2 files changed
+3320 -3302

No files matched your search

File diff suppressed because it is too large. Load diff
+18
View File
@@ -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,