Giter Club home page Giter Club logo

raml2html's Introduction

RAML to HTML converter with beautiful template.

More documentation: http://raml2html.leanlabs.io/

Examples generated documentation:

Install

Via Source

$ git clone [email protected]:raml-leanlabsio/raml2html.git && cd raml2html && composer install --no-dev

Via binary

Download latest stable release raml2html.phar release

Usage

As binary

./raml2html generate -i example/raml/basic/api.raml -o index.html

As docker image

Assuming that command executed in project directory containing raml file

docker run  \
   -v `pwd`:/data \
   leanlabs/raml-doc-builder \
   generate --input=input.raml --output=doc.html

OPTIONS

  • -i, --input input file base raml file with includes. (required)
  • -o, --output output file "index.html" (required)

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

Dependencies

raml2html's People

Contributors

cnam avatar dangoscomb avatar hnnnglmbrg avatar ravage84 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raml2html's Issues

PHPDoc

  • Add a proper file header doc block including stating the license etc.
  • Add doc bocks to functions and attributes

Raml\NamedParameter::createFromArray() must be of the type array

I'm getting this error when attempting to generate (RAML 1.0):

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/raml2html/vendor/cnam/php-raml-parser/src/Parser.php on line 614

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/raml2html/vendor/cnam/php-raml-parser/src/Parser.php on line 614

Warning: Invalid argument supplied for foreach() in phar:///usr/local/bin/raml2html/vendor/cnam/php-raml-parser/src/Parser.php on line 614

Catchable fatal error: Argument 2 passed to Raml\NamedParameter::createFromArray() must be of the type array, string given, called in phar:///usr/local/bin/raml2html/vendor/cnam/php-raml-parser/src/SecurityScheme/SecuritySchemeDescribedBy.php on line 102 and defined in phar:///usr/local/bin/raml2html/vendor/cnam/php-raml-parser/src/NamedParameter.php on line 216

My security scheme description is:

securitySchemes:
    - passthrough:
        description: This API supports PassThrough Authentication using either the query parameter "token" or header "X-API-KEY".
        type: PassThrough
        describedBy:
            queryParameters:
                token: string
            headers:
                X-API-KEY: string
            responses:
                403:
                    description: Bad token.

Raml 1.0 support

It would be great, if you added raml 1.0 features support. Thanks!

Allow to use custom template

Allow to use a custom template or allow to override certain parts of the documentation.

If this is already possible, please add documentation for it.

Docker repository not found

I am trying to run the builder from docker image (just like mentioned in README.md):

docker run  \
   -v `pwd`:/data \
   leanlabs/raml-doc-builder \
   generate --input=API.raml --output=API.html

.. and this is the error that I get:

Unable to find image 'leanlabs/raml-doc-builder:latest' locally
docker: Error response from daemon: repository leanlabs/raml-doc-builder not found: does not exist or no pull access.

Generation fails with schema in sub-dir

My RAML spec includes schema files located in a subdirectory:

.
├── my_api.raml
└── schema
    ├── some_schema.jss

Generation fails with:

failed to open stream: No such file or directory in /{snip}/raml2html-php/vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php on line 36
JSON schema not found at file:///{path to raml dir}/some_schema.jss

although RAML contains:

schemas:
  - some-schema:        !include schema/some_schema.jss

i.e. the schema sub-path is there but is ignored by the generator.

Parse Error: Cannot pass parameters to traits.

with v0.8 valid RAML like:

      [
        sortable: { fieldsList: 'firstname, lastname, activeState, employeeNo' },
        pageable
      ]

you get the following parse error:

Unable to parse at line 343 (near "[").
/Users/rrrw/Projects/contrib/raml/raml2html/vendor/symfony/yaml/Parser.php 298
#0 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/symfony/yaml/Parser.php(225): Symfony\Component\Yaml\Parser->parse('[\n  sortable: {...', true, true, false)
#1 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/symfony/yaml/Parser.php(225): Symfony\Component\Yaml\Parser->parse('is:\n  [\n    sor...', true, true, false)
#2 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/symfony/yaml/Parser.php(225): Symfony\Component\Yaml\Parser->parse('type:\n  collect...', true, true, false)
#3 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/symfony/yaml/Yaml.php(68): Symfony\Component\Yaml\Parser->parse('#%RAML 0.8\ntitl...', true, true, false)
#4 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/cnam/php-raml-parser/src/Parser.php(507): Symfony\Component\Yaml\Yaml::parse('#%RAML 0.8\ntitl...', true, true)
#5 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/cnam/php-raml-parser/src/Parser.php(478): Raml\Parser->parseYaml('#%RAML 0.8\ntitl...')
#6 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/cnam/php-raml-parser/src/Parser.php(209): Raml\Parser->parseRamlString('#%RAML 0.8\ntitl...', '/Users/rrrw/Pro...', true)
#7 /Users/rrrw/Projects/contrib/raml/raml2html/src/Generator.php(55): Raml\Parser->parse('/Users/rrrw/Pro...', true)
#8 /Users/rrrw/Projects/contrib/raml/raml2html/src/Command/GenerateCommand.php(62): Cnam\Generator->parse('/Users/rrrw/Pro...')
#9 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/symfony/console/Command/Command.php(259): Cnam\Command\GenerateCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/symfony/console/Application.php(844): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(Cnam\Command\GenerateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /Users/rrrw/Projects/contrib/raml/raml2html/vendor/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /Users/rrrw/Projects/contrib/raml/raml2html/raml2html(29): Symfony\Component\Console\Application->run()
#14 {main}

HTML Output of release 0.0.6 broken

When I generate the HTML for my RAML with release 0.0.5, it generates me a working API documentation.
When I try it with the new release 0.0.6, it's broken.

Command "api.raml" is not defined.

When I run: raml2html.phar -i api.raml -o /tmp/api.html

I receive:

                     
  [InvalidArgumentException]          
  Command "api.raml" is not defined.  

although the api.raml file exists...

Add unit tests

This will lead to cleaner code and releases with less hassle.

Generation error on valid RAML file

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}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.