Categories
Technical

How to collapse swagger tag categories by default ?

Add docExpansion:'true', in the file swagger/index.php

 <script>
    window.onload = function() {
      // Begin Swagger UI call region
      const ui = SwaggerUIBundle({
        //url: "http://davidr3.sbx.4over.com/swagger.json",
        url: "../swagger.json",
        dom_id: '#swagger-ui',
        docExpansion:'true',
        deepLinking: true,
        presets: [
          SwaggerUIBundle.presets.apis,
          SwaggerUIStandalonePreset
        ],
        plugins: [
          SwaggerUIBundle.plugins.DownloadUrl
        ],
        layout: "StandaloneLayout"
      })
      // End Swagger UI call region

      window.ui = ui
    }
  </script>

Leave a Reply