@accelbyte/codegen 1.0.2 → 1.0.4

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.
@@ -477,7 +477,7 @@ class ParserUtils {
477
477
  } else {
478
478
  const currentPrerelease = semver.prerelease(currentSemver);
479
479
  if (currentPrerelease) {
480
- nextSemver += `-${currentPrerelease}`;
480
+ nextSemver += `-${currentPrerelease.join(".")}`;
481
481
  }
482
482
  nextSemver = semver.inc(nextSemver, "prerelease", void 0, prereleaseId);
483
483
  }
@@ -561,6 +561,9 @@ class ParserUtils {
561
561
  */
562
562
  ${content}`;
563
563
  };
564
+ static sortPathParamsByPath = (pathParams, path2) => {
565
+ return pathParams.sort((a, b) => path2.indexOf(a.name) - path2.indexOf(b.name));
566
+ };
564
567
  }
565
568
  const mappedMethod = (httpMethod, isForm) => {
566
569
  if (httpMethod === "get") {
@@ -733,7 +736,8 @@ const templateMethod = ({
733
736
  let methodParamsNoTypes = "";
734
737
  let newPath = `'${path}'`;
735
738
  let importStatements = [];
736
- for (const pathParam of pathParams) {
739
+ const sortedPathParams = ParserUtils.sortPathParamsByPath(pathParams, path);
740
+ for (const pathParam of sortedPathParams) {
737
741
  const type = ParserUtils.parseType(pathParam);
738
742
  if (pathParam.name !== "namespace") {
739
743
  methodParams += pathParam.name + `:${type}, `;