Skip to content

ratza/SwaggerUIBundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwaggerUIBundle

A Symfony Bundle that integrates SwaggerUI

Installation

Require the ratza/swagger-ui-bundle package in your composer.json and update your dependencies.

Also add the swagger-api repository in your repositories key of the composer.json file:

    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "swagger-api/swagger-ui",
                "version": "2.0.24",
                "source": {
                    "url": "https://github.com/swagger-api/swagger-ui.git",
                    "type": "git",
                    "reference": "v2.0.24"
                }
            }
        }
    ]

Register the bundle in app/AppKernel.php:

// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Ratza\SwaggerUIBundle\RatzaSwaggerUIBundle(),
    );
}

Import the bundle's config files into application's config.yml file

// app/config/config.yml
imports:
    // ...
    - { resource: @RatzaSwaggerUIBundle/Resources/config/config.yml }

For the Symfony 2.6 WebProfiler to correctly count and display the AJAX requests from the SwaggerUI you need to:

  1. Create override folder: app/Resources/WebProfilerBundle/views/Profiler
  2. CD into the directory created in step 1
  3. Symlink the file from this Bundle by running:
$ ln -s ../../../../../vendor/ratza/swagger-ui-bundle/src/Ratza/SwaggerUIBundle/Resources/views/Profiler/base_js.html.twig

Reference Configuration

ratza_swagger_ui:
    force_xhr: true
    auth_key_prefix: "Bearer "
    auth_field_key: "Authorization"
    auth_field_location: "header"
    api_docs:
        route: false
        path: api/api-docs

About

A Symfony Bundle that integrates SwaggerUI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages