react-query-lightbase-codegen 0.1.9 → 0.1.10
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.
|
@@ -345,12 +345,19 @@ const generateRestfulComponent = ({ operation, verb, route, operationIds, parame
|
|
|
345
345
|
}), 'in');
|
|
346
346
|
const headerParams = header.filter((p) => !headerFilters?.includes(p.name));
|
|
347
347
|
let enabled = [];
|
|
348
|
+
let enabledParam = '!!props';
|
|
348
349
|
[...queryParams, ...pathParams, ...headerParams].forEach((item) => {
|
|
349
350
|
if (item.required) {
|
|
350
351
|
enabled.push(`["${item.name}"]`);
|
|
352
|
+
if (enabledParam) {
|
|
353
|
+
enabledParam += `&& props['${item.name}'] != null`;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
enabledParam = `props['${item.name}'] != null`;
|
|
357
|
+
}
|
|
351
358
|
}
|
|
352
359
|
});
|
|
353
|
-
|
|
360
|
+
// `!props${enabled.join('== null && !props')}`;
|
|
354
361
|
const paramsTypes = paramsInPath
|
|
355
362
|
.map((p) => {
|
|
356
363
|
try {
|
|
@@ -325,12 +325,19 @@ export const generateRestfulComponent = ({ operation, verb, route, operationIds,
|
|
|
325
325
|
}), 'in');
|
|
326
326
|
const headerParams = header.filter((p) => !headerFilters?.includes(p.name));
|
|
327
327
|
let enabled = [];
|
|
328
|
+
let enabledParam = '!!props';
|
|
328
329
|
[...queryParams, ...pathParams, ...headerParams].forEach((item) => {
|
|
329
330
|
if (item.required) {
|
|
330
331
|
enabled.push(`["${item.name}"]`);
|
|
332
|
+
if (enabledParam) {
|
|
333
|
+
enabledParam += `&& props['${item.name}'] != null`;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
enabledParam = `props['${item.name}'] != null`;
|
|
337
|
+
}
|
|
331
338
|
}
|
|
332
339
|
});
|
|
333
|
-
|
|
340
|
+
// `!props${enabled.join('== null && !props')}`;
|
|
334
341
|
const paramsTypes = paramsInPath
|
|
335
342
|
.map((p) => {
|
|
336
343
|
try {
|