@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.
|
@@ -448,14 +448,15 @@ class ParserUtils {
|
|
|
448
448
|
swaggerVersion = Number(swaggerVersion.replace(".", "").replace(".", ""));
|
|
449
449
|
swaggerVersion = isNaN(swaggerVersion) ? 0 : swaggerVersion;
|
|
450
450
|
const currentSemver = packageJSON.version;
|
|
451
|
+
const currentPrerelease = semver.prerelease(currentSemver);
|
|
451
452
|
let nextSemver = [semver.major(currentSemver), swaggerVersion, semver.patch(currentSemver)].join(".");
|
|
453
|
+
if (currentPrerelease) {
|
|
454
|
+
const [id, ...rest] = currentPrerelease;
|
|
455
|
+
nextSemver += `-${id}.${rest.join(".")}`;
|
|
456
|
+
}
|
|
452
457
|
if (!prereleaseId) {
|
|
453
458
|
nextSemver = semver.inc(nextSemver, "patch");
|
|
454
459
|
} else {
|
|
455
|
-
const currentPrerelease = semver.prerelease(currentSemver);
|
|
456
|
-
if (currentPrerelease) {
|
|
457
|
-
nextSemver += `-${currentPrerelease}`;
|
|
458
|
-
}
|
|
459
460
|
nextSemver = semver.inc(nextSemver, "prerelease", void 0, prereleaseId);
|
|
460
461
|
}
|
|
461
462
|
packageJSON.version = nextSemver;
|
|
@@ -538,6 +539,9 @@ class ParserUtils {
|
|
|
538
539
|
*/
|
|
539
540
|
${content}`;
|
|
540
541
|
};
|
|
542
|
+
static sortPathParamsByPath = (pathParams, path2) => {
|
|
543
|
+
return pathParams.sort((a, b) => path2.indexOf(a.name) - path2.indexOf(b.name));
|
|
544
|
+
};
|
|
541
545
|
}
|
|
542
546
|
const mappedMethod = (httpMethod, isForm) => {
|
|
543
547
|
if (httpMethod === "get") {
|
|
@@ -710,7 +714,8 @@ const templateMethod = ({
|
|
|
710
714
|
let methodParamsNoTypes = "";
|
|
711
715
|
let newPath = `'${path}'`;
|
|
712
716
|
let importStatements = [];
|
|
713
|
-
|
|
717
|
+
const sortedPathParams = ParserUtils.sortPathParamsByPath(pathParams, path);
|
|
718
|
+
for (const pathParam of sortedPathParams) {
|
|
714
719
|
const type = ParserUtils.parseType(pathParam);
|
|
715
720
|
if (pathParam.name !== "namespace") {
|
|
716
721
|
methodParams += pathParam.name + `:${type}, `;
|