How to bring closed collapse of Swagger UI

0

I installed Swagger for documentation of a software but would like to change the view of my template. I was able to close the collapse when loading the page by forcing a javascript to start, but it got a small bug because I have to double-click it to work.

I did something like this:

$(document).ready(function() {
  $('.opblock-tag-section').find('div').slideUp();
  $('.opblock-tag-section').click(function(){
    $(this).find('div').slideToggle();
  });
});

I made use of, "display", "none" in the div too, and then I would like to send a "block" to show it again. Even so it fights and only works on the second click. Does it have anything to do with loading json from my api on swagger? I questioned this because it mounts the interface through the json call, and I'm changing the behavior of the collapse after it loads.

    
asked by anonymous 25.04.2017 / 21:06

1 answer

0

I do not know you still need it, but I'll respond if anyone else needs it.

In SwaggerConfig in this part here:

.EnableSwaggerUi(c =>
                    { 
                       c.DocExpansion(DocExpansion.List);

DocExpansion.List to collapse e DocExpansion.Full to expanded

    
05.12.2017 / 12:58