Skip to content

@int128 int128 released this Mar 9, 2018 · 117 commits to master since this release

Released on 2018-03-09

  • #82 Add Swagger UI 3 support
  • #83 Fix possible resource leaks

If you use Swagger UI 3

Update the dependency as follows:

dependencies {
  swaggerUI 'org.webjars:swagger-ui:3.10.0'
}

Note that GenerateSwaggerUI.options and GenerateSwaggerUI.header are no longer supported. If you need them, please see Configure Swagger UI for details.

If you keep using Swagger UI 2

If you continue using Swagger UI 2.x, do the following steps:

  1. Create an index.html for Swagger UI 2.x. See also index.html for Swagger UI 2.x.
  2. Change your build.gradle to overwrite index.html after generation.
// build.gradle
swaggerSources {
    petstore {
        ui {
            // overwrite index.html for Swagger UI 2.x
            doLast {
                copy {
                    from 'index.html'
                    into outputDir
                }
            }
        }
    }
}

GenerateSwaggerUI.options and GenerateSwaggerUI.header are no longer supported.

If you have GenerateSwaggerUI.options, add it into the parameters of SwaggerUi constructor.

      window.swaggerUi = new SwaggerUi({
        spec: window.swaggerSpec,   // (mandatory) use source of swagger-spec.js
        url: null,                  // (mandatory) disable fetch
        validatorUrl: null,         // (mandatory) disable validator
        /* ADD YOUR OPTIONS HERE */

If you have GenerateSwaggerUI.header, add it into the <head> block in the index.html.

Assets 2
You can’t perform that action at this time.