twskj / pretty-swag

Pretty UI for Swagger spec
MIT License
122 stars 20 forks source link

Feature Request: Collapse by default #24

Closed edahlseng closed 7 years ago

edahlseng commented 7 years ago

It could be useful to render the html in a state that's collapsed by default. Maybe there could be two levels of collapse, one where everything is collapsed, and another where specific methods are collapsed, but paths aren't?

twskj commented 7 years ago

I might put this into a config file. something like

{
    "collapse": {
        "path": true,
        "method": true,
        "tool":true
    }
}
edahlseng commented 7 years ago

That would be perfect!

twskj commented 7 years ago

Rolled out on v0.1.96.

edahlseng commented 7 years ago

I think I've found a bug... when passing in a config option that doesn't specify anything for the collapse parameter, I get the following error:

           api.showMe = !config.collapse.path;
                                         ^
TypeError: Cannot read property 'path' of undefined

Is this intentional or a bug?

twskj commented 7 years ago

oops I'll fix that right now.

twskj commented 7 years ago

rolled out on 0.1.97. can you try it out please

edahlseng commented 7 years ago

Will do, I'll check it out tomorrow!

edahlseng commented 7 years ago

Sorry for the delay, I got carried away with work. Checked it out today, and all appears to work well!