Esempio n. 1
0
 public function testResolveYamlIncludes()
 {
     $composer = new DocumentComposer();
     $composer->setRootDir(dirname(__FILE__) . '/fixtures');
     $document = $composer->buildTree(join(['#%RAML 0.8', '---', 'somefield: !include myincludefile.yaml'], "\n"));
     $expected = ['somefield' => ['first' => '1st', 'second' => '2nd']];
     $this->assertEquals($expected, $document);
 }
Esempio n. 2
0
 public function load($input)
 {
     $version = strtok($input, "\n");
     if (!preg_match('/#%RAML 0.8/', trim($version))) {
         throw new ParseException('Document must start with #%RAML 0.8');
     }
     $documentComposer = new DocumentComposer();
     $document = $documentComposer->buildTree($input);
     $this->parseTitle($document);
     $this->parseVersion($document);
     $this->parseBaseUri($document);
     $this->parseProtocols($document);
     $this->parseMediaType($document);
     $this->parseSchemas($document);
     return $this->specification;
 }