Skip to content

Commit 7e7abcf

Browse files
committed
chore(python): don't add duplicated values to dict
Correction for 4caebf2 commit. Relate to #16
1 parent 0dd5283 commit 7e7abcf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/python/fastapi/postgres/routes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def post_v1_categories(body: CreateCategoryDto, conn=Depends(db_connection)):
116116
, NOW()
117117
, %(user_id)s
118118
)
119-
""", {"name": body.name, "name_ru": body.name_ru, "slug": body.slug, "user_id": body.user_id, "user_id": body.user_id})
119+
""", {"name": body.name, "name_ru": body.name_ru, "slug": body.slug, "user_id": body.user_id})
120120
finally:
121121
conn.close()
122122

src/cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ const createEndpoints = async (destDir, { lang }, config) => {
276276
// (used only with Python)
277277
"formatParamsAsPythonDict": (params) => {
278278
return params.length > 0
279-
? ', {' + params.map(param => param.substring(2)).map(param => `"${param}": body.${param}`).join(', ') + '}'
279+
? ', {' + [...new Set(params)].map(param => param.substring(2)).map(param => `"${param}": body.${param}`).join(', ') + '}'
280280
: ''
281281
},
282282

0 commit comments

Comments
 (0)