forked from mirror/Riven
1
0
Fork 0

Fix handling of names for 'type' arg

v/1.x.x
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) { function formatAddQueryParam(param) {
let k = `"${param.name}"`; const k = `"${param.name}"`;
let name = changeCase.snakeCase(param.name); const name = normalizePropName(param.name);
let nc = param.required ? '' : `if let Some(${name}) = ${name} `; const nc = param.required ? '' : `if let Some(${name}) = ${name} `;
let prop = param.schema; const prop = param.schema;
switch (prop.type) { switch (prop.type) {
case 'array': return `${nc}{ query_params.extend_pairs(${name}.iter()` case 'array': return `${nc}{ query_params.extend_pairs(${name}.iter()`
+ `.map(|w| (${k}, ${formatQueryParamStringify("w", prop.items, true)}))); }`; + `.map(|w| (${k}, ${formatQueryParamStringify("w", prop.items, true)}))); }`;

View File

@ -108,7 +108,7 @@ impl<'a> {{= endpoint }}<'a> {
let required = paramList === pathParams; let required = paramList === pathParams;
for (let param of paramList) 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 })); dotUtils.stringifyType(param.schema, { endpoint, optional: !required, owned: false }));
} }
} }