Giter VIP home page Giter VIP logo

Comments (7)

uderline avatar uderline commented on August 17, 2024

Hi !

This is an interesting one ! Well I guess this would be quite easy to implement. PathMethodBuilder would need a little cleaning up to easily extend it. Would you want to also set the builder as a general setting or is it for a specific route in your case ?

Do you have anything "core" that could be added in for everyone ? Could you share what is missing for you ?

Thanks,

from openapi-php-attributes.

dam1r89 avatar dam1r89 commented on August 17, 2024

I'm mocking up something in a PR (not a solution) to give you an idea.

from openapi-php-attributes.

dam1r89 avatar dam1r89 commented on August 17, 2024

One more note, it was difficult to make it run with a Laravel, so I had to bootstrap app differently:

Artisan::command('openapi-generate', function () {
    $files = Symfony\Component\Finder\Finder::create()
        ->files()
        ->name('*.php')
        ->in([app_path('PublicApi/v2')]);

    foreach ($files as $autoload) {
        include_once $autoload->getPathName();
    }

    $generate = \OpenApiGenerator\Generator::create()->generate();

    echo json_encode($generate, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
});

It would be great if class names could be passed as an argument of Generator::create() (or generate method) that way I could decide how to fetch those classes instead of relying on get_declared_classes() function.

from openapi-php-attributes.

uderline avatar uderline commented on August 17, 2024

Ok I get the idea, thanks for the PR. I'll try some stuff and will come back to you with a proposition.

For the class list as a command argument, I'm not totally sure because you can already specify the path (or paths) to your controller(s).

from openapi-php-attributes.

dam1r89 avatar dam1r89 commented on August 17, 2024

I understand that specifying paths is only an option if you are using the tool as a CLI rather than as a library. That's okay, I can find another solution to that problem.

from openapi-php-attributes.

uderline avatar uderline commented on August 17, 2024

Ok so after several months, I managed to find some time to work on a solution -- hopefully you are still using this lib.

So, I refactored the HttpGenerator (it needed to be done anyway) and added a dynamic builder as you suggested on this commit 8df02e0

I'd like your input on wether it was what you were expecting

from openapi-php-attributes.

dam1r89 avatar dam1r89 commented on August 17, 2024

Hah, thanks for considering it. Yes, I still want to use this library. I will try to play around with this version and make it work.

from openapi-php-attributes.

Related Issues (11)

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.