kevupton / auto-swagger-ui

7 stars 4 forks source link

Specify Swagger Yaml Location #1

Open djfurman opened 6 years ago

djfurman commented 6 years ago

Just came across your project on Laracasts forums and I'm excited to get started.

I still consider myself a swagger beginner; is there a way to load or specify a directory of swagger.yml files at which I can point the UI?

I would strongly prefer to write my interfaces independent of my code implementation and avoid any annotation scanning requirements.

kevupton commented 6 years ago

Hey @djfurman Yes it should be possible to write your own swagger.json files, I dont think swagger-ui supports yml yet. You could create an endpoint which converts your yml spec to json.

To do this without the scanner, just disable it in the config,

  'urls' => [
        // where the swagger ui will be located
        'ui' => env('SWAGGER_UI_URL', '/api/swagger'),

        // where the json will be located
        'json' => env('SWAGGER_JSON_URL', '/api/swagger.json') // <=== set your endpoint here
    ],

    // whether or not to enable the swagger scanner
    'scanner_enabled' => env('SWAGGER_SCAN_ENABLED', false), // <==== disable it here

Then under urls.json just set your endpoint where you are serving the swagger configuration.