ng-openapi 0.2.7 → 0.2.8
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.
- package/cli.cjs +6 -6
- package/index.js +5 -5
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -44,7 +44,7 @@ var fs4 = __toESM(require("fs"));
|
|
|
44
44
|
var path12 = __toESM(require("path"));
|
|
45
45
|
|
|
46
46
|
// package.json
|
|
47
|
-
var version = "0.2.
|
|
47
|
+
var version = "0.2.7";
|
|
48
48
|
|
|
49
49
|
// src/lib/core/generator.ts
|
|
50
50
|
var import_ts_morph7 = require("ts-morph");
|
|
@@ -2071,7 +2071,7 @@ var ServiceMethodBodyGenerator = class {
|
|
|
2071
2071
|
let urlExpression = `\`\${this.basePath}${operation.path}\``;
|
|
2072
2072
|
if (context.pathParams.length > 0) {
|
|
2073
2073
|
context.pathParams.forEach((param) => {
|
|
2074
|
-
urlExpression = urlExpression.replace(`{${param.name}}`, `\${${param.name}}`);
|
|
2074
|
+
urlExpression = urlExpression.replace(`{${param.name}}`, `\${${camelCase(param.name)}}`);
|
|
2075
2075
|
});
|
|
2076
2076
|
}
|
|
2077
2077
|
return `const url = ${urlExpression};`;
|
|
@@ -2080,8 +2080,8 @@ var ServiceMethodBodyGenerator = class {
|
|
|
2080
2080
|
if (context.queryParams.length === 0) {
|
|
2081
2081
|
return "";
|
|
2082
2082
|
}
|
|
2083
|
-
const paramMappings = context.queryParams.map((param) => `if (${param.name} != null) {
|
|
2084
|
-
params = HttpParamsBuilder.addToHttpParams(params, ${param.name}, '${param.name}');
|
|
2083
|
+
const paramMappings = context.queryParams.map((param) => `if (${camelCase(param.name)} != null) {
|
|
2084
|
+
params = HttpParamsBuilder.addToHttpParams(params, ${camelCase(param.name)}, '${param.name}');
|
|
2085
2085
|
}`).join("\n");
|
|
2086
2086
|
return `
|
|
2087
2087
|
let params = new HttpParams();
|
|
@@ -2292,7 +2292,7 @@ var ServiceMethodParamsGenerator = class {
|
|
|
2292
2292
|
const pathParams = operation.parameters?.filter((p) => p.in === "path") || [];
|
|
2293
2293
|
pathParams.forEach((param) => {
|
|
2294
2294
|
params.push({
|
|
2295
|
-
name: param.name,
|
|
2295
|
+
name: camelCase(param.name),
|
|
2296
2296
|
type: getTypeScriptType(param.schema || param, this.config),
|
|
2297
2297
|
hasQuestionToken: !param.required
|
|
2298
2298
|
});
|
|
@@ -2323,7 +2323,7 @@ var ServiceMethodParamsGenerator = class {
|
|
|
2323
2323
|
const queryParams = operation.parameters?.filter((p) => p.in === "query") || [];
|
|
2324
2324
|
queryParams.forEach((param) => {
|
|
2325
2325
|
params.push({
|
|
2326
|
-
name: param.name,
|
|
2326
|
+
name: camelCase(param.name),
|
|
2327
2327
|
type: getTypeScriptType(param.schema || param, this.config),
|
|
2328
2328
|
hasQuestionToken: !param.required
|
|
2329
2329
|
});
|
package/index.js
CHANGED
|
@@ -2196,7 +2196,7 @@ var _ServiceMethodBodyGenerator = class _ServiceMethodBodyGenerator {
|
|
|
2196
2196
|
let urlExpression = `\`\${this.basePath}${operation.path}\``;
|
|
2197
2197
|
if (context.pathParams.length > 0) {
|
|
2198
2198
|
context.pathParams.forEach((param) => {
|
|
2199
|
-
urlExpression = urlExpression.replace(`{${param.name}}`, `\${${param.name}}`);
|
|
2199
|
+
urlExpression = urlExpression.replace(`{${param.name}}`, `\${${camelCase(param.name)}}`);
|
|
2200
2200
|
});
|
|
2201
2201
|
}
|
|
2202
2202
|
return `const url = ${urlExpression};`;
|
|
@@ -2205,8 +2205,8 @@ var _ServiceMethodBodyGenerator = class _ServiceMethodBodyGenerator {
|
|
|
2205
2205
|
if (context.queryParams.length === 0) {
|
|
2206
2206
|
return "";
|
|
2207
2207
|
}
|
|
2208
|
-
const paramMappings = context.queryParams.map((param) => `if (${param.name} != null) {
|
|
2209
|
-
params = HttpParamsBuilder.addToHttpParams(params, ${param.name}, '${param.name}');
|
|
2208
|
+
const paramMappings = context.queryParams.map((param) => `if (${camelCase(param.name)} != null) {
|
|
2209
|
+
params = HttpParamsBuilder.addToHttpParams(params, ${camelCase(param.name)}, '${param.name}');
|
|
2210
2210
|
}`).join("\n");
|
|
2211
2211
|
return `
|
|
2212
2212
|
let params = new HttpParams();
|
|
@@ -2421,7 +2421,7 @@ var _ServiceMethodParamsGenerator = class _ServiceMethodParamsGenerator {
|
|
|
2421
2421
|
const pathParams = ((_a = operation.parameters) == null ? void 0 : _a.filter((p) => p.in === "path")) || [];
|
|
2422
2422
|
pathParams.forEach((param) => {
|
|
2423
2423
|
params.push({
|
|
2424
|
-
name: param.name,
|
|
2424
|
+
name: camelCase(param.name),
|
|
2425
2425
|
type: getTypeScriptType(param.schema || param, this.config),
|
|
2426
2426
|
hasQuestionToken: !param.required
|
|
2427
2427
|
});
|
|
@@ -2452,7 +2452,7 @@ var _ServiceMethodParamsGenerator = class _ServiceMethodParamsGenerator {
|
|
|
2452
2452
|
const queryParams = ((_e = operation.parameters) == null ? void 0 : _e.filter((p) => p.in === "query")) || [];
|
|
2453
2453
|
queryParams.forEach((param) => {
|
|
2454
2454
|
params.push({
|
|
2455
|
-
name: param.name,
|
|
2455
|
+
name: camelCase(param.name),
|
|
2456
2456
|
type: getTypeScriptType(param.schema || param, this.config),
|
|
2457
2457
|
hasQuestionToken: !param.required
|
|
2458
2458
|
});
|