swagger-api / swagger-editor

Swagger Editor
https://editor.swagger.io
Apache License 2.0
8.96k stars 2.26k forks source link

Add a view only mode? #719

Closed teknolog2000 closed 8 years ago

teknolog2000 commented 9 years ago

Since Swagger Editor today renders better than Swagger UI, I would like to use Swagger Editor as a rendering engine for our API docs. For example, it renders securityDefinitions and lists all the models at the bottom.

Has this been discussed before? Seems quite simple to add a config flag to make this happen.

fehguy commented 9 years ago

many like it more. many hate it. right now, it's a separate project, and I believe you can disable the editor portion.

teknolog2000 commented 9 years ago

That would be great, but I can't find a setting for that in the config file: https://github.com/swagger-api/swagger-editor/blob/master/app/config/defaults.json

What might it be? Should I just dig through the code to figure it out?

fehguy commented 9 years ago

yes, the primary author is on soma holiday right now so if you'd like to dig in yourself that'd be best.

chrisdudley commented 9 years ago

You can hide the editor pane in CSS, or I have had some success with modifying the router to simply not load the editor or header panes at all. But that was a nasty hack and not something that could be merged in.

yewton commented 8 years ago

Hi,

FYI, I want view-only mode too, so I made a sample project to achieve it: https://github.com/yewton/swagger-top-down-playground This can render a local spec file and preview it.

This uses Backend as storage and modifies the view to disable editor pain.

yewton commented 8 years ago

may be https://github.com/swagger-api/swagger-editor/issues/664 is a related issue.

fehguy commented 8 years ago

This is indeed a duplicate. Let's track in the other issue.

marklagendijk commented 7 years ago

You can customize the index.html and add custom javascript or css (either inline or externaly). With the following css you can hide the editor and make the viewer full screen:

.pane.editor, .ui-splitbar{
    display: none;
}

.pane.preview{
    left: 0 !important;
    width: 100% !important;
}

With the following javascript you can start with the editor closed, but still have the ability to open it:

SwaggerEditor.run(function($timeout){
     $timeout(function(){
         document.getElementsByClassName('ui-splitbar-icon-left')[0].click();
     });
});
himanshupareek commented 6 years ago

Its already mentioned there in swagger-editor.css file, so you can get this css code and override within your local html page.

/**

LionH commented 4 years ago

Isn't the purpose of swagger-ui to only show the API Docs?