Sebiworld / AppApi

Module to create a REST API with ProcessWire CMS
MIT License
43 stars 10 forks source link

Swagger documentation #29

Closed spoetnik closed 1 year ago

spoetnik commented 2 years ago

It would be really useful to have automatic Swagger documentation for our API.

Sebiworld commented 2 years ago

Hi @spoetnik !

That sounds interesting! Let's work together! How exactly do you envision that? Are you already familiar with Swagger?

Let me get a few thoughts out of my head:

laikmosh commented 2 years ago

Sounds amazing, could probably use the phpdoc syntaxis, it even allows Markdown as part of the description and can be accessed via php https://www.php.net/manual/en/reflectionclass.getdoccomment.php https://stackoverflow.com/questions/11741302/how-do-i-put-blocks-of-php-code-into-a-phpdoc-docblock

happy to help with this if needed

Sebiworld commented 1 year ago

With v1.3.0 I have implemented a solution for this which does not need to read the php files and their phpdoc comments like @laikmosh said. I hope that this solution does fit in your workflows as well. My project apis have become much clearer since the update and I can very easily import the Swagger documentation that is generated into Postman for testing! Have a look at the wiki-page to see how it is done.