@accelbyte/codegen 1.0.2 → 1.0.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.
|
@@ -471,14 +471,15 @@ class ParserUtils {
|
|
|
471
471
|
swaggerVersion = Number(swaggerVersion.replace(".", "").replace(".", ""));
|
|
472
472
|
swaggerVersion = isNaN(swaggerVersion) ? 0 : swaggerVersion;
|
|
473
473
|
const currentSemver = packageJSON.version;
|
|
474
|
+
const currentPrerelease = semver.prerelease(currentSemver);
|
|
474
475
|
let nextSemver = [semver.major(currentSemver), swaggerVersion, semver.patch(currentSemver)].join(".");
|
|
476
|
+
if (currentPrerelease) {
|
|
477
|
+
const [id, ...rest] = currentPrerelease;
|
|
478
|
+
nextSemver += `-${id}.${rest.join(".")}`;
|
|
479
|
+
}
|
|
475
480
|
if (!prereleaseId) {
|
|
476
481
|
nextSemver = semver.inc(nextSemver, "patch");
|
|
477
482
|
} else {
|
|
478
|
-
const currentPrerelease = semver.prerelease(currentSemver);
|
|
479
|
-
if (currentPrerelease) {
|
|
480
|
-
nextSemver += `-${currentPrerelease}`;
|
|
481
|
-
}
|
|
482
483
|
nextSemver = semver.inc(nextSemver, "prerelease", void 0, prereleaseId);
|
|
483
484
|
}
|
|
484
485
|
packageJSON.version = nextSemver;
|
|
@@ -561,6 +562,9 @@ class ParserUtils {
|
|
|
561
562
|
*/
|
|
562
563
|
${content}`;
|
|
563
564
|
};
|
|
565
|
+
static sortPathParamsByPath = (pathParams, path2) => {
|
|
566
|
+
return pathParams.sort((a, b) => path2.indexOf(a.name) - path2.indexOf(b.name));
|
|
567
|
+
};
|
|
564
568
|
}
|
|
565
569
|
const mappedMethod = (httpMethod, isForm) => {
|
|
566
570
|
if (httpMethod === "get") {
|
|
@@ -733,7 +737,8 @@ const templateMethod = ({
|
|
|
733
737
|
let methodParamsNoTypes = "";
|
|
734
738
|
let newPath = `'${path}'`;
|
|
735
739
|
let importStatements = [];
|
|
736
|
-
|
|
740
|
+
const sortedPathParams = ParserUtils.sortPathParamsByPath(pathParams, path);
|
|
741
|
+
for (const pathParam of sortedPathParams) {
|
|
737
742
|
const type = ParserUtils.parseType(pathParam);
|
|
738
743
|
if (pathParam.name !== "namespace") {
|
|
739
744
|
methodParams += pathParam.name + `:${type}, `;
|