diff --git a/src/index.js b/src/index.js index 54ab49e..4393fb6 100644 --- a/src/index.js +++ b/src/index.js @@ -334,14 +334,22 @@ function parseBody(ramlBody, srMethod) { if (_.isUndefined(srMethod.parameters)) srMethod.parameters = []; - srMethod.parameters.push({ + //Fix for the body parameter - empty schema to be set to empty object + //Schema is mandatory for body parameter + var bodyRequest = { //FIXME: check if name is used; name: 'body', in: 'body', required: true, //TODO: copy example schema: convertSchema(_.get(ramlBody[jsonMIME], 'schema')) - }); + }; + + if (!bodyRequest.schema) { + bodyRequest.schema = {type: "object"}; + } + + srMethod.parameters.push(bodyRequest); } function convertSchema(schema) {