raml-leanlabsio / raml2html

raml2html documentation generator
http://raml2html.leanlabs.io
MIT License
32 stars 9 forks source link

Generation error on valid RAML file #2

Open ddossot opened 9 years ago

ddossot commented 9 years ago

I'm trying to generate the doc for this RAML: https://api.unbounce.com/raml/v0.4/api.raml

Here is the error I get:

array(1) {
  ["schema"]=>
  string(3008) "{"$schema":"http:\/\/json-schema.org\/draft-04\/schema#","description":"Collection of account entities.","type":"object","additionalProperties":false,"required":["accounts","metadata"],"properties":{"accounts":{"type":"array","minItems":0,"uniqueItems":true,"items":{"$schema":"http:\/\/json-schema.org\/draft-04\/schema#","description":"TODO describe","type":"object","additionalProperties":false,"required":["created_at","id","metadata","name","options","state"],"properties":{"created_at":{"title":"Generic Date","description":"RFC 5322, section 3.4.1, compliant date, which means formatted with: yyyy-MM-dd'T'HH:mm:ss.SSS'Z'","type":"string","format":"date-time","id":"file:\/\/\/home\/ddossot\/dev\/projects\/ub-public-api-specs\/resources\/webroot\/raml\/v0.4\/schema\/common\/definitions_v2.0.json#\/date"},"id":{"type":"string"},"metadata":{"type":"object","allOf":[{"title":"Entity Metadata","type":"object","required":["location","documentation"],"properties":{"location":{"type":"string","format":"uri"},"documentation":{"type":"string","format":"uri"},"related":{"type":"object"}},"id":"file:\/\/\/home\/ddossot\/dev\/projects\/ub-public-api-specs\/resources\/webroot\/raml\/v0.4\/schema\/common\/entities_v2.0.json#\/entity_metadata"},{"type":"object","required":["related"],"properties":{"related":{"type":"object","additionalProperties":false,"required":["pages","accounts","sub_accounts"],"properties":{"pages":{"type":"string","format":"uri"},"accounts":{"type":"string","format":"uri"},"sub_accounts":{"type":"string","format":"uri"}}}}}],"id":"file:\/\/\/home\/ddossot\/dev\/projects\/ub-public-api-specs\/resources\/webroot\/raml\/v0.4\/schema\/metadata.json#\/account_metadata"},"name":{"type":"string"},"options":{"$schema":"http:\/\/json-schema.org\/draft-04\/schema#","type":"object","additionalProperties":false,"properties":{"api_keys_enabled":{"type":"boolean"}},"id":"file:\/\/\/home\/ddossot\/dev\/projects\/ub-public-api-specs\/resources\/webroot\/raml\/v0.4\/schema\/account_options.json"},"state":{"type":"string","enum":["active","suspended"]}},"id":"file:\/\/\/home\/ddossot\/dev\/projects\/ub-public-api-specs\/resources\/webroot\/raml\/v0.4\/schema\/account.json"}},"metadata":{"title":"Collection Metadata","type":"object","allOf":[{"title":"Entity Metadata","type":"object","required":["location","documentation"],"properties":{"location":{"type":"string","format":"uri"},"documentation":{"type":"string","format":"uri"},"related":{"type":"object"}},"id":"file:\/\/\/home\/ddossot\/dev\/projects\/ub-public-api-specs\/resources\/webroot\/raml\/v0.4\/schema\/common\/entities_v2.0.json#\/entity_metadata"},{"type":"object","required":["count"],"properties":{"count":{"type":"integer"}}}],"id":"file:\/\/\/home\/ddossot\/dev\/projects\/ub-public-api-specs\/resources\/webroot\/raml\/v0.4\/schema\/common\/entities_v2.0.json#\/collection_metadata"}},"id":"file:\/\/\/home\/ddossot\/dev\/projects\/ub-public-api-specs\/resources\/webroot\/raml\/v0.4\/schema\/accounts.json"}"
}
The key application/vnd.unbounce.api.v0.4+json does not exist.
phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php 333
#0 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(336): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#1 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(336): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#2 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(336): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#3 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(336): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#4 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(273): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#5 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(211): Raml\Parser->parseRamlData(Array, '/home/ddossot/d...', true)
#6 phar:///home/ddossot/dev/tools/raml2html.phar/src/Generator.php(55): Raml\Parser->parse('/home/ddossot/d...', true)
#7 phar:///home/ddossot/dev/tools/raml2html.phar/src/Command/GenerateCommand.php(62): Cnam\Generator->parse('/home/ddossot/d...')
#8 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Cnam\Command\GenerateCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Cnam\Command\GenerateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 phar:///home/ddossot/dev/tools/raml2html.phar/index.php(15): Symfony\Component\Console\Application->run()
#13 /home/ddossot/dev/tools/raml2html.phar(10): include('phar:///home/dd...')
#14 {main}
cnam commented 9 years ago

Hello, @ddossot

Your a use mediaType application/vnd.unbounce.api.v0.4+json that is not standard and does not pass validation.

This bug confirmed

If your change media type to application/json then generator will be correct working

ddossot commented 9 years ago

Thanks for confirming the bug! Looking forward to a fix, I really like the design of the doc this tool generates :smile:

cnam commented 9 years ago

Hello, @ddossot

We have released version 0.0.4 can be downloaded from the link,

http://raml2html.leanlabs.io/raml2html.phar

ddossot commented 9 years ago

Thanks!

Here is the error I receive now:

Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
PHP Notice:  Undefined index: application/vnd.unbounce.api.v0.4+json in phar:///home/ddossot/dev/tools/raml2html-0.0.4.phar/vendor/cnam/php-raml-parser/src/Parser.php on line 331
PHP Fatal error:  Call to a member function setSourceUri() on a non-object in phar:///home/ddossot/dev/tools/raml2html-0.0.4.phar/vendor/cnam/php-raml-parser/src/Parser.php on line 332
cnam commented 9 years ago

I am sorry, please try again.

http://raml2html.leanlabs.io/raml2html.phar

ddossot commented 9 years ago

Thank you :+1: I get a different error now:

Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: key: application/vnd.unbounce.api.v0.4+json not found from accept types application/json,text/json,application/(.*?)+json
Warning: Not valid json or file not found.
JSON:'page_group'
Invalid JSON.
phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Schema/Parser/JsonSchemaParser.php 46
#0 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(340): Raml\Schema\Parser\JsonSchemaParser->createSchemaDefinition('page_group', '/home/ddossot/d...')
#1 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(342): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#2 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(342): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#3 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(342): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#4 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(342): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#5 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(342): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#6 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(273): Raml\Parser->recurseAndParseSchemas(Array, '/home/ddossot/d...')
#7 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/cnam/php-raml-parser/src/Parser.php(211): Raml\Parser->parseRamlData(Array, '/home/ddossot/d...', true)
#8 phar:///home/ddossot/dev/tools/raml2html.phar/src/Generator.php(55): Raml\Parser->parse('/home/ddossot/d...', true)
#9 phar:///home/ddossot/dev/tools/raml2html.phar/src/Command/GenerateCommand.php(62): Cnam\Generator->parse('/home/ddossot/d...')
#10 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Cnam\Command\GenerateCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Cnam\Command\GenerateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 phar:///home/ddossot/dev/tools/raml2html.phar/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 phar:///home/ddossot/dev/tools/raml2html.phar/index.php(15): Symfony\Component\Console\Application->run()
#15 /home/ddossot/dev/tools/raml2html.phar(10): include('phar:///home/dd...')
#16 {main}

You can check the API Console for my RAML file here: https://api.unbounce.com/console.html It may help you debug the issue?