Skip to content

Commit 0262ff3

Browse files
committed
Removed schema if not set
1 parent 3e35e91 commit 0262ff3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

swagger/swagger.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,16 @@ module.exports = function(RED) {
235235
Object.keys(swaggerDocNode.responses).forEach(status => {
236236
const responseDetails = swaggerDocNode.responses[status];
237237
operation.responses[status] = {
238-
description: responseDetails.description || '',
239-
content: {
240-
'application/json': {
241-
schema: {
242-
// Define or reference your schema here
243-
}
244-
}
245-
}
238+
description: responseDetails.description || 'No description',
239+
content: {}
246240
};
241+
242+
// Conditionally add schema if it's set
243+
if (responseDetails.schema) {
244+
operation.responses[status].content['application/json'] = {
245+
schema: responseDetails.schema
246+
};
247+
}
247248
});
248249
} else {
249250
console.error('swaggerDocNode.responses is not an object or is null:', swaggerDocNode.responses);

0 commit comments

Comments
 (0)