Fix handling of names for 'type' arg

This commit is contained in:
Mingwei Samuel 2021-06-30 14:07:37 -07:00
parent 5987a6f07f
commit 612ffde26b
2 changed files with 5 additions and 5 deletions

View file

@ -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)}))); }`;

View file

@ -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 }));
}
}