Skip to content

Commit

Permalink
[transform/paths] Remove parameters replacing (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
Semigradsky authored Oct 29, 2022
1 parent a4e05fa commit 15589e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
5 changes: 1 addition & 4 deletions src/transform/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,7 @@ export function makeApiPathsEnum(paths: Record<string, PathItemObject>): string
.join("");
}

// Replace {parameters} with :parameters
const adaptedUrl = url.replace(/{(\w+)}/g, ":$1");

output += ` ${pathName} = "${adaptedUrl}",\n`;
output += ` ${pathName} = "${url}",\n`;
}
}

Expand Down
18 changes: 9 additions & 9 deletions test/bin/expected/paths-enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,19 +570,19 @@ export enum ApiPaths {
addPet = "/pet",
findPetsByStatus = "/pet/findByStatus",
findPetsByTags = "/pet/findByTags",
getPetById = "/pet/:petId",
updatePetWithForm = "/pet/:petId",
deletePet = "/pet/:petId",
uploadFile = "/pet/:petId/uploadImage",
getPetById = "/pet/{petId}",
updatePetWithForm = "/pet/{petId}",
deletePet = "/pet/{petId}",
uploadFile = "/pet/{petId}/uploadImage",
getInventory = "/store/inventory",
placeOrder = "/store/order",
getOrderById = "/store/order/:orderId",
deleteOrder = "/store/order/:orderId",
getOrderById = "/store/order/{orderId}",
deleteOrder = "/store/order/{orderId}",
createUser = "/user",
createUsersWithListInput = "/user/createWithList",
loginUser = "/user/login",
logoutUser = "/user/logout",
getUserByName = "/user/:username",
updateUser = "/user/:username",
deleteUser = "/user/:username",
getUserByName = "/user/{username}",
updateUser = "/user/{username}",
deleteUser = "/user/{username}",
}

0 comments on commit 15589e4

Please sign in to comment.