@accelbyte/codegen 2.0.0-beta.4 → 2.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -617,7 +617,9 @@ class ParserUtils {
617
617
  ${content}`;
618
618
  };
619
619
  static sortPathParamsByPath = (pathParams, path2) => {
620
- return pathParams.sort((a, b) => path2.indexOf(a.name) - path2.indexOf(b.name));
620
+ const params = path2.match(/{\w*}/g) || [];
621
+ const cleanParams = params.map((param) => param.replace("{", "").replace("}", ""));
622
+ return pathParams.sort((a, b) => cleanParams.indexOf(a.name) - cleanParams.indexOf(b.name));
621
623
  };
622
624
  }
623
625
  const mappedMethod = (httpMethod, isForm) => {
@@ -1304,6 +1306,7 @@ class CodeGenerator {
1304
1306
  continue;
1305
1307
  }
1306
1308
  const [tag] = endpoint.tags;
1309
+ const pathWithBase = `${api.basePath ?? ""}${path2}`;
1307
1310
  mapClassMethods[tag] = mapClassMethods[tag] ? mapClassMethods[tag] : {};
1308
1311
  const isForm = endpoint.consumes && endpoint.consumes[0] === "application/x-www-form-urlencoded";
1309
1312
  const classMethod = ParserUtils.generateNaturalLangMethod({
@@ -1314,7 +1317,7 @@ class CodeGenerator {
1314
1317
  existingMethods: mapClassMethods[tag]
1315
1318
  });
1316
1319
  mapClassMethods[tag][classMethod] = `${path2} ${httpMethod}`;
1317
- snippetMap[path2] = snippetMap[path2] ? snippetMap[path2] : {};
1320
+ snippetMap[pathWithBase] = snippetMap[pathWithBase] ? snippetMap[pathWithBase] : {};
1318
1321
  let description = endpoint.description;
1319
1322
  description = description || "";
1320
1323
  description = description.replace(/\s+/g, " ");
@@ -1329,7 +1332,6 @@ class CodeGenerator {
1329
1332
  arrayDefinitions.push(responseClass);
1330
1333
  }
1331
1334
  const queryParams = ParserUtils.filterQueryParameters(endpoint.parameters);
1332
- const pathWithBase = `${api.basePath ?? ""}${path2}`;
1333
1335
  const isFormUrlEncoded = ParserUtils.isFormUrlEncoded(httpMethod, endpoint.consumes);
1334
1336
  const pathParams = ParserUtils.filterPathParams(endpoint.parameters);
1335
1337
  let bodyParams = ParserUtils.filterBodyParams(endpoint.parameters);
@@ -1372,7 +1374,7 @@ class CodeGenerator {
1372
1374
  const serviceNameTitle = ParserUtils.convertDashesToTitleCase(serviceName);
1373
1375
  const { apiGenName } = ParserUtils.generateApiName(tag);
1374
1376
  const resultSnippet = templateSdkSnippet(serviceNameTitle, apiGenName, snippetMethod);
1375
- snippetMap[path2][httpMethod] = {
1377
+ snippetMap[pathWithBase][httpMethod] = {
1376
1378
  web: resultSnippet,
1377
1379
  webGit: GIT_URL + `/sdk-${serviceName}/src/generated-public/${serviceName}/${apiGenName}.ts`,
1378
1380
  shell: snippetShell