From 612ffde26bc20e01db94ee1046f2ffb723e3e4a1 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Wed, 30 Jun 2021 14:07:37 -0700 Subject: [PATCH] Fix handling of names for 'type' arg --- srcgen/dotUtils.js | 8 ++++---- srcgen/endpoints.rs.dt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/srcgen/dotUtils.js b/srcgen/dotUtils.js index c05e9e8..579136f 100644 --- a/srcgen/dotUtils.js +++ b/srcgen/dotUtils.js @@ -127,10 +127,10 @@ function formatQueryParamStringify(name, prop, useOwned = false) { } function formatAddQueryParam(param) { - let k = `"${param.name}"`; - let name = changeCase.snakeCase(param.name); - let nc = param.required ? '' : `if let Some(${name}) = ${name} `; - let prop = param.schema; + const k = `"${param.name}"`; + const name = normalizePropName(param.name); + const nc = param.required ? '' : `if let Some(${name}) = ${name} `; + const prop = param.schema; switch (prop.type) { case 'array': return `${nc}{ query_params.extend_pairs(${name}.iter()` + `.map(|w| (${k}, ${formatQueryParamStringify("w", prop.items, true)}))); }`; diff --git a/srcgen/endpoints.rs.dt b/srcgen/endpoints.rs.dt index cd8b24f..4c9af93 100644 --- a/srcgen/endpoints.rs.dt +++ b/srcgen/endpoints.rs.dt @@ -108,7 +108,7 @@ impl<'a> {{= endpoint }}<'a> { let required = paramList === pathParams; for (let param of paramList) { - argBuilder.push(', ', dotUtils.changeCase.snakeCase(param.name), ': ', + argBuilder.push(', ', dotUtils.normalizePropName(param.name), ': ', dotUtils.stringifyType(param.schema, { endpoint, optional: !required, owned: false })); } }