/**
  * Parse a RAML file
  * 
  * @param string $raml_string	The RAML string to parse
  * @param string $root_dir		The root directory to parse !include files (Defaults to the "raml"
  * 								directory for the module.)
  * @param bool $parse_schemas	True to parse included RAML files, or false not to (Defaults to true)
  * 
  * @return mixed The \Raml\APIDefinition object, or false if the RAML string didn't exist
  */
 public static function parse($raml_string = null, $root_dir = null, $parse_schemas = true)
 {
     // Find the RAML string.
     if (empty($raml_string) && ($raml_string = static::get_raml_string()) === false) {
         return false;
     }
     // Use the default root directory for RAML files.
     if (empty($root_dir)) {
         $root_dir = __DIR__ . DS . '..' . DS . 'raml';
     }
     // Build the settings object.
     $parser_config_obj = new \Raml\ParseConfiguration();
     if ($parse_schemas === true) {
         $parser_config_obj->enableSchemaParsing();
     } else {
         $parser_config_obj->disableSchemaParsing();
     }
     /*
      * Don't create security settings parser objects. They restrict settings to only those the parsers
      * specify.
      */
     $parser_config_obj->disableSecuritySchemeParsing();
     $parser = new \Raml\Parser(null, null, null, $parser_config_obj);
     /**
      * Prevent the parser from automatically merging security scheme data with the method.
      * 
      * @link https://github.com/alecsammon/php-raml-parser/issues/68
      */
     //$parser->setMergeSecurity();
     try {
         $api_def = $parser->parseFromString($raml_string, $root_dir);
     } catch (\Raml\Exception\InvalidSchemaTypeException $e) {
         return \Utility::format_error(500, \V1\Err::INVALID_SCHEMA_TYPE, \Lang::get('v1::errors.invalid_schema_type'));
     }
     return $api_def;
 }
 /** @test */
 public function shouldNotParseIncludedJsonIfNotRequired()
 {
     $config = new \Raml\ParseConfiguration();
     $config->disableSchemaParsing();
     $this->parser->setConfiguration($config);
     $simpleRaml = $this->parser->parse(__DIR__ . '/fixture/includeSchema.raml');
     $resource = $simpleRaml->getResourceByUri('/songs');
     $method = $resource->getMethod('get');
     $response = $method->getResponse(200);
     $body = $response->getBodyByType('application/json');
     $schema = $body->getSchema();
     $this->assertInternalType('string', $schema);
 }