File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def get_v1_categories_count():
2222 finally :
2323 conn .close ()
2424
25- @router .get ('/v1/collections/: collectionId/categories/count' )
25+ @router .get ('/v1/collections/{ collectionId} /categories/count' )
2626def get_v1_collections_collection_id_categories_count ():
2727 conn = psycopg2 .connect (
2828 database = os .getenv ('DB_NAME' ),
@@ -46,7 +46,7 @@ def get_list_v1_categories():
4646def post_v1_categories ():
4747 pass
4848
49- @router .get ('/v1/categories/: categoryId' )
49+ @router .get ('/v1/categories/{ categoryId} ' )
5050def get_v1_categories_category_id ():
5151 conn = psycopg2 .connect (
5252 database = os .getenv ('DB_NAME' ),
@@ -62,11 +62,11 @@ def get_v1_categories_category_id():
6262 finally :
6363 conn .close ()
6464
65- @router .put ('/v1/categories/: categoryId' )
65+ @router .put ('/v1/categories/{ categoryId} ' )
6666def put_v1_categories_category_id ():
6767 pass
6868
69- @router .delete ('/v1/categories/: categoryId' )
69+ @router .delete ('/v1/categories/{ categoryId} ' )
7070def delete_v1_categories_category_id ():
7171 pass
7272
Original file line number Diff line number Diff line change @@ -12,8 +12,14 @@ function generate_method_name(method, path) {
1212 return ` ${ method}${ name} `
1313}
1414
15+ // "/categories/:categoryId" => "/categories/{categoryId}"
16+ function convertToFastApiPath (path ) {
17+ return path .replace (/ :([_a-zA-Z ] + )/ g , ' {$1}' )
18+ }
19+
20+
1521endpoints .forEach (function (endpoint ) {
16- const path = endpoint .path
22+ const path = convertToFastApiPath ( endpoint .path )
1723
1824 endpoint .methods .forEach (function (method ) {
1925 const hasGetOne = method .name === ' get'
You can’t perform that action at this time.
0 commit comments