@ng-openapi/http-resource 0.0.21 → 0.0.23
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/index.cjs +7 -7
- package/index.js +7 -7
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -71,7 +71,7 @@ function getTypeScriptType(schemaOrType, config, formatOrNullable, isNullable, c
|
|
|
71
71
|
}
|
|
72
72
|
if (schema2.type === "array") {
|
|
73
73
|
const itemType = schema2.items ? getTypeScriptType(schema2.items, config, void 0, void 0, context) : "unknown";
|
|
74
|
-
return nullable ? `(
|
|
74
|
+
return nullable ? `(Array<${itemType}> | null)` : `Array<${itemType}>`;
|
|
75
75
|
}
|
|
76
76
|
switch (schema2.type) {
|
|
77
77
|
case "string":
|
|
@@ -3083,7 +3083,7 @@ var HttpResourceMethodBodyGenerator = class {
|
|
|
3083
3083
|
let urlExpression = `\`\${this.basePath}${operation.path}\``;
|
|
3084
3084
|
if (context.pathParams.length > 0) {
|
|
3085
3085
|
context.pathParams.forEach((param) => {
|
|
3086
|
-
urlExpression = urlExpression.replace(`{${param.name}}`, `\${typeof ${param.name} === 'function' ? ${param.name}() : ${param.name}}`);
|
|
3086
|
+
urlExpression = urlExpression.replace(`{${param.name}}`, `\${typeof ${camelCase(param.name)} === 'function' ? ${camelCase(param.name)}() : ${camelCase(param.name)}}`);
|
|
3087
3087
|
});
|
|
3088
3088
|
}
|
|
3089
3089
|
return urlExpression;
|
|
@@ -3092,9 +3092,9 @@ var HttpResourceMethodBodyGenerator = class {
|
|
|
3092
3092
|
if (context.queryParams.length === 0) {
|
|
3093
3093
|
return "";
|
|
3094
3094
|
}
|
|
3095
|
-
const paramMappings = context.queryParams.map((param) => `const ${param.name}Value = typeof ${param.name} === 'function' ? ${param.name}() : ${param.name};
|
|
3096
|
-
if (${param.name}Value != null) {
|
|
3097
|
-
params = HttpParamsBuilder.addToHttpParams(params, ${param.name}Value, '${param.name}');
|
|
3095
|
+
const paramMappings = context.queryParams.map((param) => `const ${camelCase(param.name)}Value = typeof ${camelCase(param.name)} === 'function' ? ${camelCase(param.name)}() : ${camelCase(param.name)};
|
|
3096
|
+
if (${camelCase(param.name)}Value != null) {
|
|
3097
|
+
params = HttpParamsBuilder.addToHttpParams(params, ${camelCase(param.name)}Value, '${param.name}');
|
|
3098
3098
|
}`).join("\n");
|
|
3099
3099
|
return `
|
|
3100
3100
|
let params = new HttpParams();
|
|
@@ -3213,7 +3213,7 @@ var HttpResourceMethodParamsGenerator = class {
|
|
|
3213
3213
|
const paramType = getTypeScriptType(param.schema || param, this.config);
|
|
3214
3214
|
const signalParamType = param.required ? `Signal<${paramType}>` : `Signal<${paramType} | undefined>`;
|
|
3215
3215
|
params.push({
|
|
3216
|
-
name: param.name,
|
|
3216
|
+
name: camelCase(param.name),
|
|
3217
3217
|
type: `${signalParamType} | ${paramType}`,
|
|
3218
3218
|
hasQuestionToken: !param.required
|
|
3219
3219
|
});
|
|
@@ -3223,7 +3223,7 @@ var HttpResourceMethodParamsGenerator = class {
|
|
|
3223
3223
|
const paramType = getTypeScriptType(param.schema || param, this.config);
|
|
3224
3224
|
const signalParamType = param.required ? `Signal<${paramType}>` : `Signal<${paramType} | undefined>`;
|
|
3225
3225
|
params.push({
|
|
3226
|
-
name: param.name,
|
|
3226
|
+
name: camelCase(param.name),
|
|
3227
3227
|
type: `${signalParamType} | ${paramType}`,
|
|
3228
3228
|
hasQuestionToken: !param.required
|
|
3229
3229
|
});
|
package/index.js
CHANGED
|
@@ -37,7 +37,7 @@ function getTypeScriptType(schemaOrType, config, formatOrNullable, isNullable, c
|
|
|
37
37
|
}
|
|
38
38
|
if (schema2.type === "array") {
|
|
39
39
|
const itemType = schema2.items ? getTypeScriptType(schema2.items, config, void 0, void 0, context) : "unknown";
|
|
40
|
-
return nullable ? `(
|
|
40
|
+
return nullable ? `(Array<${itemType}> | null)` : `Array<${itemType}>`;
|
|
41
41
|
}
|
|
42
42
|
switch (schema2.type) {
|
|
43
43
|
case "string":
|
|
@@ -3049,7 +3049,7 @@ var HttpResourceMethodBodyGenerator = class {
|
|
|
3049
3049
|
let urlExpression = `\`\${this.basePath}${operation.path}\``;
|
|
3050
3050
|
if (context.pathParams.length > 0) {
|
|
3051
3051
|
context.pathParams.forEach((param) => {
|
|
3052
|
-
urlExpression = urlExpression.replace(`{${param.name}}`, `\${typeof ${param.name} === 'function' ? ${param.name}() : ${param.name}}`);
|
|
3052
|
+
urlExpression = urlExpression.replace(`{${param.name}}`, `\${typeof ${camelCase(param.name)} === 'function' ? ${camelCase(param.name)}() : ${camelCase(param.name)}}`);
|
|
3053
3053
|
});
|
|
3054
3054
|
}
|
|
3055
3055
|
return urlExpression;
|
|
@@ -3058,9 +3058,9 @@ var HttpResourceMethodBodyGenerator = class {
|
|
|
3058
3058
|
if (context.queryParams.length === 0) {
|
|
3059
3059
|
return "";
|
|
3060
3060
|
}
|
|
3061
|
-
const paramMappings = context.queryParams.map((param) => `const ${param.name}Value = typeof ${param.name} === 'function' ? ${param.name}() : ${param.name};
|
|
3062
|
-
if (${param.name}Value != null) {
|
|
3063
|
-
params = HttpParamsBuilder.addToHttpParams(params, ${param.name}Value, '${param.name}');
|
|
3061
|
+
const paramMappings = context.queryParams.map((param) => `const ${camelCase(param.name)}Value = typeof ${camelCase(param.name)} === 'function' ? ${camelCase(param.name)}() : ${camelCase(param.name)};
|
|
3062
|
+
if (${camelCase(param.name)}Value != null) {
|
|
3063
|
+
params = HttpParamsBuilder.addToHttpParams(params, ${camelCase(param.name)}Value, '${param.name}');
|
|
3064
3064
|
}`).join("\n");
|
|
3065
3065
|
return `
|
|
3066
3066
|
let params = new HttpParams();
|
|
@@ -3179,7 +3179,7 @@ var HttpResourceMethodParamsGenerator = class {
|
|
|
3179
3179
|
const paramType = getTypeScriptType(param.schema || param, this.config);
|
|
3180
3180
|
const signalParamType = param.required ? `Signal<${paramType}>` : `Signal<${paramType} | undefined>`;
|
|
3181
3181
|
params.push({
|
|
3182
|
-
name: param.name,
|
|
3182
|
+
name: camelCase(param.name),
|
|
3183
3183
|
type: `${signalParamType} | ${paramType}`,
|
|
3184
3184
|
hasQuestionToken: !param.required
|
|
3185
3185
|
});
|
|
@@ -3189,7 +3189,7 @@ var HttpResourceMethodParamsGenerator = class {
|
|
|
3189
3189
|
const paramType = getTypeScriptType(param.schema || param, this.config);
|
|
3190
3190
|
const signalParamType = param.required ? `Signal<${paramType}>` : `Signal<${paramType} | undefined>`;
|
|
3191
3191
|
params.push({
|
|
3192
|
-
name: param.name,
|
|
3192
|
+
name: camelCase(param.name),
|
|
3193
3193
|
type: `${signalParamType} | ${paramType}`,
|
|
3194
3194
|
hasQuestionToken: !param.required
|
|
3195
3195
|
});
|