Giter VIP home page Giter VIP logo

Comments (7)

bfanger avatar bfanger commented on August 30, 2024

The hardcoded "vendor/autoload.php" is used when swagger-php installed as a standalone project. (and composer install is run from the swagger-php directory)

When swagger-php is installed as a require in another project the relative path "../../../autoload.php" is used.
https://github.com/zircote/swagger-php/blob/master/bin/swagger#L31

What error are you getting?

from swagger-php.

alexmcroberts avatar alexmcroberts commented on August 30, 2024

Having setup the composer.json to use the CakePHP "Vendor" directory...

In terminal I run the following command from the app folder inside a CakePHP project:

php ./Vendor/zircote/swagger-php/swagger.phar -p ./Controller -o ./webroot -f -i ./webroot/index.php &> ./webroot/api-docs/swagger-log.html

The error I get is:

You must set up the project dependencies, run the following commands: wget http://getcomposer.org/composer.phar php composer.phar install

If I change my composer.json file to use the default "vendor" directory, I get no such error, and the api-docs are correctly generated.

from swagger-php.

bfanger avatar bfanger commented on August 30, 2024

I've got the error too, a temporary workaround is to use the bin/swagger instead of the phar.

php ./Vendor/zircote/swagger-php/bin/swagger -p ./Controller -o ./webroot -f -i ./webroot/index.php &> ./webroot/api-docs/swagger-log.html

from swagger-php.

alexmcroberts avatar alexmcroberts commented on August 30, 2024

@bfanger have you tried to use swagger-php with the AuthComponent enabled? My app/Controller/AppController.php begins like this:

<?php
App::uses( 'Controller', 'Controller' );
class AppController extends Controller {
    // Add the debugkit tool bar
    public $components = array(
        'DebugKit.Toolbar', 
        'Session',
        'Cookie',
        'RequestHandler',
        'Auth'
    );
...

When I run swagger-php I see no output in the webroot/api-docs/swagger-log.html page as used in the above command, but when I comment out the AuthComponent - 'Auth', and run the exact same command, I get the "./webroot/api-docs.json created" as output in the swagger-log.html page.

(For any readers, I am outputting the content of swagger-php to a .html page in my webroot as it includes some CakePHP generated HTML, and it's easier to read this in a browser, rather than decipher inline CSS, and JavaScript in a terminal window)

from swagger-php.

bfanger avatar bfanger commented on August 30, 2024

Probably fixed by #68 in the 0.6 branch , which can be installed with composer:

"require": {
   "zircote/swagger-php": "0.6.*@dev"
}

The -i webroot/index.php won't be needed anymore.

from swagger-php.

alexmcroberts avatar alexmcroberts commented on August 30, 2024

I'll definitely give this a go during the week, but for now I can say that with master-dev, I've found that with CakePHP removing 'Auth' from public $components array(); and moving it to the beforeFilter of the AppController with an App::import('Component','Auth'); also works.

I was waiting for static analysis - can't wait to check this out!

from swagger-php.

bfanger avatar bfanger commented on August 30, 2024

swagger.phar bug fixed in 6e3dc13 (0.6 branch)

from swagger-php.

Related Issues (20)

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.