Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a view only mode? #719

Closed
teknolog2000 opened this issue Nov 18, 2015 · 10 comments
Closed

Add a view only mode? #719

teknolog2000 opened this issue Nov 18, 2015 · 10 comments

Comments

@teknolog2000
Copy link

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
Copy link
Contributor

fehguy commented Nov 19, 2015

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

@teknolog2000
Copy link
Author

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
Copy link
Contributor

fehguy commented Nov 20, 2015

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

@chrisdudley
Copy link
Contributor

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
Copy link

yewton commented Dec 14, 2015

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
Copy link

yewton commented Dec 19, 2015

may be #664 is a related issue.

@fehguy
Copy link
Contributor

fehguy commented Dec 19, 2015

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

@fehguy fehguy closed this as completed Dec 19, 2015
@marklagendijk
Copy link

marklagendijk commented Jan 19, 2017

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
Copy link

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

/**

  • Styling for printing out of the editor
    */

.Pane1,
.topbar {
display: none;
}
.SplitPane {
position: relative !important;
display: block !important;
}
.Pane2 {
overflow-y: auto;
width: 100% !important;
}

@LionH
Copy link

LionH commented Jun 15, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants