Linking to custom documentation file
Hello! I'm looking for answer for my problem: how to link to documentation from custom file? I run the swagger ui docker instance using this command 'docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui' and add some other documentation files next to the swagger.json, so I can switch between them on the site but I can't create link that opens additional file with documentation. Is exists any way to do that? Any path variable like this ip:port/#/users/search?documentation=/doc_v2.json ?SolvedSwagger UI: authorization modal logout/authorize issue
Library version: swagger-ui-dist#3.32.5 Problem : It is not possible to authorize again inside same 'Authorization modal' after logout is clicked Steps to reproduce : 1. Click 'Authorize' button in Swagger UI 2. enter proper client id and client secrets. 3. check necessary scopes 4. click Authorize button below. 5. do proper auth actions in a separate tab. 6. After successful auth process second tab is closed and 'Logout' button appears instead of 'Authorize' (meanwhile auth token endpoint is accessed with proper authorization code) 7. click 'Logout' button (it should be disappear and 'Authorize' should appear. Also clientid+clientsecret + checkboxes remain with the same data) 8. click Authorize. 9. do necessary auth actions in separate tab 10. see next error response in 'Authorization modal' :AuthErrorError, error: invalid_grant, description: Authorization code is invalid or expired. Investigation results: 1. oauth2-redirect.html endpoint sends proper authorization code back to main tab. 2. however authActions.authorizeRequest will receive auth code from first authentication try (steps 1-5) 3. It seems redux state is not properly updated during recieving callback fromoauth2-redirect.html 4. issue is reproducible on local environment as well as in swagger hub.Swagger UI not showing operations with same Path but different HTTP method
For example I have 2 API operations: GET v1/people/{id} POST v1/people/{id} Only one of these operations is shown in my Swagger UI API docs but I want both of them displayed. I have many examples where this is the case. In the Swagger documentation it states: "Swagger defines a unique operation as a combination of a path and an HTTP method." This would make me think what I want to do is possible as they are uniquely identified by the HTTP method. If I change the path parameter for one in my swagger.yaml file they will both show. eg: GET v1/people/{personid} POST v1/people/{id} But I would rather keep them all standard otherwise my API docs will appear messy. I am using swagger-ui-express 4.1.4. Please see StackOverflow post with code:https://stackoverflow.com/questions/62769866/swagger-ui-not-showing-operations-with-same-path-but-different-http-method Thanks for your help.SolvedHow we can display single API inside Swagger UI or Swagger Widget? Swagger Widget for Web available?
I am trying to create a Swagger API documentation like the attached screenshot. I have a swagger endpoint. I want to customize Swagger UI to display API document as follows: How can I create this kind of documentation? Is there any product like Swagger Widget which I can put on webpages and try out Single APIs? I am using React, ASP.Net Core and Swasbuckle Core. Pls let me know. Thanks in advance.SolvedHow use Authrozation Field on Header with GET Swagger-UI
I have a endpoint to authenticati I have a endpoint to authenticate the users. This endpoint is a GET Method what receive the user email and password on Header in Authorization field. This endpoint responses with JWT token. So my header contains: Authorization Basic "some codificated string on base64" Then i get the Authorization value, the "some codificated string on base64" and decode to a normal string with value1:value2, where value1 is the user email and the value2 is the password. So how i do this on the swagger file to can authenticate user and get my jwt token? My app is nodejs and is: app.get('/login', (req, res) => { const hash = req.headers.authorization.split(' ')[1]; const [mail, password] = Buffer.from(hash, 'base64') .toString() .split(':'); //so i validate the user and answer in response with the jwt token res.json({ access_token: jwt}); });Download Excel file as a response from Open Api 3
I am editing in editor.swagger.io How can I download response from API locally which is a excel file? My snippet - responses: 200: description: "JSON to Excel conversion succeeded" content: application/vnd.ms-excel: schema: type: string format: binary I get server response of 200 saying 😱 Could not render this component, see the console In console the response headers are - cache-control: public, max-age=0 content-length: 8515 content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet expires: Tue, 10 Dec 2019 15:14:55 GMT I want to save excel file locally.SolvedCXF Swagger2Feature return the same swagger.json
am trying to generate swaggger documentation for our APIs. what i did is creating a bean based on the org.apache.cxf.jaxrs.swagger.Swagger2Feature: <bean id="MySwagger2Feature" class="org.apache.cxf.jaxrs.swagger.Swagger2Feature" abstract="true"> <property name="scanAllResources" value="true"/> <property name="title" value="Swagger API for Restful Services"/> <property name="description" value="Swagger API for Restful Services"/> <property name="version" value="1.0.0"/><!--TODO:: version --> <property name="prettyPrint" value="true"/> </bean> and then for each Service(Endpoint) i created a separate bean that extends the parent bean. exp <bean id="dashboardSwagger" parent="MySwagger2Feature"> <property name="basePath" value="/services/rest/dashboard"/> </bean> <bean id="usersSwagger" parent="MySwagger2Feature"> <property name="basePath" value="/services/rest/users"/> </bean> and then add them to the <property name="features"> , but the problem is that all the services return the same swagger.json and that is the one that comes first in the Alphabet order. so i searched the internet and some developers said that i should add <property name="usePathBasedConfig" value="true" /> to each child bean. and when i did that all the services now just return this swagger.json file. { "swagger": "2.0" } Any Suggestions please.1.3KViews0likes1CommentCustomize Swagger-UI to serve multiple Json Files
Hello Folks, I have an application with many Rest Services and Models and now i want to generate Swagger Documentation for these services, and i just went with Swagger. I added swagger and swagger-ui to my Application and at first it looks Perfect, but once i finished adding all my Services i ended up with some problems, the major problem is the Swagger-UI , because Swagger generate one single json file api-docs for all the services, this files got big and so when i access the swagger-ui it crashes because the file is so big and the browser runs out of memory. i searched but i didn't find a solution for the swagger-ui but i found a maven plugin that can generate mutiple json files : maven-swagger-plugin so now i have different files containing different documentation for my services, but my problem now is how can i make swagger-ui dynamic so i can order one json file per time and render it in the ui. thanks2.5KViews0likes0CommentsSwagger Authentication hardcoded options
I was wondering if anyone has found a way when using swagger-ui to have some hardcoded authentication options. My vision of this would be to navigate to your swagger-ui and when you click the green "Authorize" button rather than a empty box showing up you could get a couple clickable options to choose from. The reason this would help me is because number one I want my swagger documentation to be as easy to use as possible so other devs on my team will see it as a asset. I also don't want the people integrating with my API to have to worry about where to get their JWT from in order to use my swagger-ui. And lastly depending on the type of information and what you are doing with it you will need different JWT's, so rather than having to enter a massive JWT everytime a user needs permissions they could just click an option that holds the value of a certian JWT and be logged in that way.807Views0likes0Comments