alt3 / cakephp-swagger

Swagger plugin for documenting your CakePHP APIs
MIT License
64 stars 17 forks source link

Add support for providing custom Analyser object #33

Closed georgeconstantinou closed 7 years ago

georgeconstantinou commented 7 years ago

You can provide a custom swagger Analyser class using Swagger configuration as follows:

<?php
use App\Swagger\MyCustomAnalyser;

return [
    'Swagger' => [
        'analyser' => new MyCustomAnalyser()
    ]
];
bravo-kernel commented 7 years ago

Do I understand correctly that this will allow one to automatically generate the swagger spec from the code? If so, that would be an amazing feature and one I am happy to merge in.

The failing tests seem unrelated, let me see if I can solve those first.

bravo-kernel commented 7 years ago

@georgeconstantinou I solved the travis issues, could you please trigger a commit?

georgeconstantinou commented 7 years ago

@bravo-kernel can you trigger the build without a commit by going here and pressing Restart build button in the top right?

bravo-kernel commented 7 years ago

Neat trick, thanks ☺️

bravo-kernel commented 7 years ago

@georgeconstantinou a rebase against current master is required (because of travis), could you please do that?

georgeconstantinou commented 7 years ago

@bravo-kernel in our scenario we have swagger annotations generated on the fly. In order for swagger to pick them up we implemented our own Analyser. Swagger supports alternative locations via the analyser, that is why we need this option.

codecov-io commented 7 years ago

Codecov Report

Merging #33 into master will not change coverage. The diff coverage is 100%.

@@           Coverage Diff           @@
##             master    #33   +/-   ##
=======================================
  Coverage       100%   100%           
- Complexity       31     32    +1     
=======================================
  Files             5      5           
  Lines            98    100    +2     
=======================================
+ Hits             98    100    +2
Impacted Files Coverage Δ Complexity Δ
src/Lib/SwaggerTools.php 100% <100%> (ø) 11 <0> (+1) :white_check_mark:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fe9b31a...ea441da. Read the comment docs.

bravo-kernel commented 7 years ago

OK, that sounds like the killer feature we all have been longing for. Is that Analyser logic available for us?

georgeconstantinou commented 7 years ago

@bravo-kernel we actually built the whole thing based on your tutorial (thank you very much). All the code is in this PR to our sub-system. If you need any assistance just let me know.

bravo-kernel commented 7 years ago

@georgeconstantinou sorry, I should have taken more time to read the PR you referenced to, the analyser is right there. Thanks for the PR.

georgeconstantinou commented 7 years ago

@bravo-kernel can you please tag the new version?

bravo-kernel commented 7 years ago

Awesome, I might ping you if I need help, automated annotations have been on my list for soooo long ;)

bravo-kernel commented 7 years ago

https://github.com/alt3/cakephp-swagger/releases/tag/1.0.4, thanks a lot 💯

georgeconstantinou commented 7 years ago

@bravo-kernel thanks a lot, much appreciated