public function testShouldParseJsonSchema() { $parser = new Parser(); $document = $parser->load(join(['#%RAML 0.8', '---', 'title: MyApi', 'baseUri: http://myapi.com', 'schemas:', ' - foo: |', ' {', ' "$schema": "http://json-schema.org/schema",', ' "type": "object",', ' "description": "A canonical song",', ' "properties": {', ' "title": { "type": "string" },', ' "artist": { "type": "string" }', ' },', ' "required": [ "title", "artist" ]', ' }'], "\n")); $expected = ['title' => 'MyApi', 'baseUri' => 'http://myapi.com', 'protocols' => ['HTTP'], 'schemas' => ['foo' => ['type' => 'object', 'description' => 'A canonical song', 'properties' => ['title' => ['type' => 'string'], 'artist' => ['type' => 'string']], 'required' => ['title', 'artist']]]]; $this->assertEquals($expected, $document); }
public function testShouldParseMediaType() { $parser = new Parser(); $document = $parser->load(join(['#%RAML 0.8', '---', 'title: MyApi', 'baseUri: http://myapi.com', 'version: "1.0"', 'mediaType: application/json'], "\n")); $expected = ['title' => 'MyApi', 'version' => '1.0', 'baseUri' => 'http://myapi.com', 'protocols' => ['HTTP'], 'mediaType' => 'application/json']; $this->assertEquals($expected, $document); }