resolveBodyData = (context, requestBodySchema, bodyType, isExampleBody = false,
    responseCode = null, requestBodyExamples = {}
  ) => {
    let { parametersResolution, indentCharacter } = context.computedOptions,
      headerFamily = getHeaderFamily(bodyType),
      bodyData = '',
      shouldGenerateFromExample = parametersResolution === 'example',
      isBodyTypeXML = bodyType === APP_XML || bodyType === TEXT_XML || headerFamily === HEADER_TYPE.XML,
      bodyKey = isExampleBody ? 'response' : 'request',
      responseExamples,
      example,
      examples,
      resolvedSchemaTypes = [];

    if (_.isEmpty(requestBodySchema)) {
      return [{ [bodyKey]: bodyData }];
    }

    if (requestBodySchema.$ref) {
      requestBodySchema = resolveSchema(
        context,
        requestBodySchema,
        { isResponseSchema: isExampleBody }
      );
    }

    /**
     * We'll be picking up example data from `value` only if
     * `value` is the only key present at the root level;
     * e.g: {
     *  example: {
     *    value: {
     *      a: 1,
     *      b: 1
     *    }
     *  }
     * }
     * In the above case example should be :{
     *      a: 1,
     *      b: 1
     *    }
     * example: {
     *    value: 1,
     *    a: 1,
     *    b: 2
     *  }
     * But for this example it should be {
     *    value: 1,
     *    a: 1,
     *    b: 2
     *  }
     */

    if (requestBodySchema.example !== undefined) {
      const shouldResolveValueKey = _.has(requestBodySchema.example, 'value') &&
        _.keys(requestBodySchema.example).length <= 1;

      example = shouldResolveValueKey ?
        requestBodySchema.example.value :
        requestBodySchema.example;
    }
    else if (_.get(requestBodySchema, 'schema.example') !== undefined) {
      const shouldResolveValueKey = _.has(requestBodySchema.schema.example, 'value') &&
        _.keys(requestBodySchema.schema.example).length <= 1;

      example = shouldResolveValueKey ?
        requestBodySchema.schema.example.value :
        requestBodySchema.schema.example;
    }

    examples = requestBodySchema.examples || _.get(requestBodySchema, 'schema.examples');

    requestBodySchema = requestBodySchema.schema || requestBodySchema;
    requestBodySchema = resolveSchema(
      context,
      requestBodySchema,
      { isResponseSchema: isExampleBody });

    // If schema object has example defined, try to use that if no example is defiend at request body level
    if (example === undefined && _.get(requestBodySchema, 'example') !== undefined) {
      example = requestBodySchema.example;
    }

    if (shouldGenerateFromExample && (example !== undefined || examples)) {
      /**
       * Here it could be example or examples (plural)
       * For examples, we'll pick the first example
       */
      const exampleData = example || getExampleData(context, examples);

      if (isBodyTypeXML) {
        bodyData = getXMLExampleData(context, exampleData, requestBodySchema);
      }
      else {
        bodyData = exampleData;
      }
    }
    else if (requestBodySchema) {
      requestBodySchema = requestBodySchema.schema || requestBodySchema;

      if (requestBodySchema.$ref) {
        requestBodySchema = resolveSchema(
          context,
          requestBodySchema,
          { isResponseSchema: isExampleBody });
      }

      if (isBodyTypeXML) {
        bodyData = xmlFaker(null, requestBodySchema, indentCharacter, parametersResolution);
      }
      else {
        if (requestBodySchema.properties) {
          // If any property exists with format:binary or byte schemaFaker crashes
          // we just delete based on that format

          // TODO: This could have properties inside properties which needs to be handled
          // That's why for some properties we are not deleting the format
          _.forOwn(requestBodySchema.properties, (schema, prop) => {
            if (!_.isObject(requestBodySchema.properties[prop])) {
              return;
            }

            if (
              requestBodySchema.properties[prop].format === 'byte' ||
              requestBodySchema.properties[prop].format === 'decimal'
            ) {
              delete requestBodySchema.properties[prop].format;
            }
          });
        }

        // This is to handle cases when the jsf throws errors on finding unsupported types/formats
        try {
          bodyData = fakeSchema(context, requestBodySchema, shouldGenerateFromExample);
        }
        catch (e) {
          console.warn(
            'Error faking a schema. Not faking this schema. Schema:', requestBodySchema,
            'Error', e.message
          );

          bodyData = '';
        }
      }

    }

    if (context.enableTypeFetching && requestBodySchema.type !== undefined) {
      const requestBodySchemaTypes = processSchema(requestBodySchema);
      resolvedSchemaTypes.push(requestBodySchemaTypes);
    }

    // Generate multiple examples when either request or response contains more than one example
    if (
      isExampleBody &&
      shouldGenerateFromExample &&
      (_.size(examples) > 1 || _.size(requestBodyExamples) > 1)
    ) {
      responseExamples = [{
        key: '_default',
        value: bodyData,
        contentType: bodyType,
        responseCode
      }];

      if (!_.isEmpty(examples)) {
        responseExamples = _.map(examples, (example, key) => {
          return {
            key,
            value: example,
            contentType: bodyType
          };
        });
      }

      let matchedRequestBodyExamples = _.filter(requestBodyExamples, ['contentType', bodyType]);

      // If content-types are not matching, match with any present content-types
      if (_.isEmpty(matchedRequestBodyExamples)) {
        matchedRequestBodyExamples = requestBodyExamples;
      }

      const generatedBody = generateExamples(
        context, responseExamples, matchedRequestBodyExamples, requestBodySchema, isBodyTypeXML);

      return {
        generatedBody,
        resolvedSchemaType: resolvedSchemaTypes[0]
      };
    }

    return {
      generatedBody: [{ [bodyKey]: bodyData }],
      resolvedSchemaType: resolvedSchemaTypes[0]
    };
  }
Resolves the request/response body data

@param {Object} context - Global context object
@param {Object} requestBodySchema - Schema of the request / response body
@param {String} bodyType - Content type of the body
@param {Boolean} isExampleBody - Whether the body is example body
@param {String} responseCode - Response code
@param {Object} requestBodyExamples - Examples defined in the request body
@returns {Array} Request / Response body data