fix: APIPathGen에서 NumVar, StrVar 동작 오류

This commit is contained in:
2022-04-13 02:49:11 +09:00
parent cc73f8c5d6
commit 715a66fd35
+10 -3
View File
@@ -14,16 +14,23 @@ export function APIPathGen(obj, callback, path, pathParams) {
} }
const varType = target.__nextVarType; const varType = target.__nextVarType;
const varKey = target.__nextVarKey; let varKey = target.__nextVarKey;
let next; let next;
if (varType !== undefined && varKey !== undefined) { if (varType !== undefined && varKey !== undefined) {
if (typeof key !== varType) { if(varType == 'number'){
throw `${key} is not ${varType}`; if(key != Number(key)){
throw `${key} is not ${varType}`;
}
key = Number(key);
}
else if ((typeof key) !== varType) {
throw `${key} is not ${varType}, but ${typeof key}`;
} }
if(pathParams === undefined){ if(pathParams === undefined){
pathParams = {} pathParams = {}
} }
pathParams[varKey] = key; pathParams[varKey] = key;
nextPath.pop();
next = target.next; next = target.next;
} }
else if (key in target) { else if (key in target) {