Skip to content

Commit da74344

Browse files
fix fe empty request bodies
1 parent 9e65ab8 commit da74344

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

forward_engineering/helpers/componentsHelpers/parametersHelper.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,21 @@ function getContent(data, isParentActivated) {
9999
return;
100100
}
101101

102-
return Object.keys(data.properties).reduce((acc, key) => {
102+
const result = Object.keys(data.properties).reduce((acc, key) => {
103103
const properties = get(data, `properties[${key}].properties`);
104104
if (!properties) {
105-
return;
105+
return acc;
106106
}
107107
const schemaKeyword = getSchemaKeyword(properties);
108+
109+
if (!schemaKeyword) {
110+
return acc;
111+
}
112+
108113
const isSchemaEmpty = properties[schemaKeyword] && get(properties, [schemaKeyword, 'type']) === 'object' && !get(properties, [schemaKeyword, 'properties']);
109114
const isExamplesEmpty = !get(properties, 'examples.properties');
110115
if (isSchemaEmpty && isExamplesEmpty) {
111-
return;
116+
return acc;
112117
}
113118
const isActivated = data.properties[key].isActivated;
114119
acc[key] = commentDeactivatedItemInner(
@@ -121,6 +126,12 @@ function getContent(data, isParentActivated) {
121126
);
122127
return acc;
123128
}, {});
129+
130+
if (!Object.keys(result).length) {
131+
return;
132+
}
133+
134+
return result;
124135
}
125136

126137
function mapMediaTypeObject(data, isParentActivated = false) {

0 commit comments

Comments
 (0)