Skip to content

Commit 15589e4

Browse files
authored
[transform/paths] Remove parameters replacing (#951)
1 parent a4e05fa commit 15589e4

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/transform/paths.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,7 @@ export function makeApiPathsEnum(paths: Record<string, PathItemObject>): string
124124
.join("");
125125
}
126126

127-
// Replace {parameters} with :parameters
128-
const adaptedUrl = url.replace(/{(\w+)}/g, ":$1");
129-
130-
output += ` ${pathName} = "${adaptedUrl}",\n`;
127+
output += ` ${pathName} = "${url}",\n`;
131128
}
132129
}
133130

test/bin/expected/paths-enum.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -570,19 +570,19 @@ export enum ApiPaths {
570570
addPet = "/pet",
571571
findPetsByStatus = "/pet/findByStatus",
572572
findPetsByTags = "/pet/findByTags",
573-
getPetById = "/pet/:petId",
574-
updatePetWithForm = "/pet/:petId",
575-
deletePet = "/pet/:petId",
576-
uploadFile = "/pet/:petId/uploadImage",
573+
getPetById = "/pet/{petId}",
574+
updatePetWithForm = "/pet/{petId}",
575+
deletePet = "/pet/{petId}",
576+
uploadFile = "/pet/{petId}/uploadImage",
577577
getInventory = "/store/inventory",
578578
placeOrder = "/store/order",
579-
getOrderById = "/store/order/:orderId",
580-
deleteOrder = "/store/order/:orderId",
579+
getOrderById = "/store/order/{orderId}",
580+
deleteOrder = "/store/order/{orderId}",
581581
createUser = "/user",
582582
createUsersWithListInput = "/user/createWithList",
583583
loginUser = "/user/login",
584584
logoutUser = "/user/logout",
585-
getUserByName = "/user/:username",
586-
updateUser = "/user/:username",
587-
deleteUser = "/user/:username",
585+
getUserByName = "/user/{username}",
586+
updateUser = "/user/{username}",
587+
deleteUser = "/user/{username}",
588588
}

0 commit comments

Comments
 (0)