B
B
BloodVIRUS2021-06-10 13:42:48
Yii
BloodVIRUS, 2021-06-10 13:42:48

How to slide swagger in yii2?

Hello. For general education, I want to learn how to work with a swagger.

There are articles that describe how to work with it. And at first glance, three simple steps are described there:

1. We put the swagger into the project with Composer
2. The front folder is taken from the swagger github and uploaded to web / docs
3. A controller is created, SwaggerController, in it the only action in which directories are specified for scanning.

After that, we launch (doesn't matter from the console, from the address bar) this controller \ action, it scans the directories, and based on them, based on the markup for the swagger, they create a json file, which is indicated in step 2 in index.html

And it seems like everything should work. But damn it, the controller code for generating json does not work, although it is the same in different sources.

One of my friends generally says that it is not necessary to generate a json file. Everything is generated on the fly, but I can’t even google something like this .. Please help me, I’ve been trying to figure it out for the second day, but nothing happens. Maybe I'm looking in the wrong place?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question