forked from mirror/Riven
Fix handling of names for 'type' arg
parent
5987a6f07f
commit
612ffde26b
|
@ -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)}))); }`;
|
||||||
|
|
|
@ -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 }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue