swagger-ui

Prevent Swagger from automatically adding some models

独自空忆成欢 提交于 2021-01-28 03:10:29
问题 I build a REST interface using Spring Boot framework. Then, I use Swagger version 2.9.2 to generate the documentation. As you can see from the photo below, Swagger automatically detects a lot of models. However, most of them are redundant. Among them, only the ResponseMessage is necessary, the rest are just standard Java class. So, my question is: how can I tell Swagger which models to expose ? Here are my Swagger configuration and code snippet of my controller. @Bean public Docket api() {

Basic Authentication using Swagger UI

a 夏天 提交于 2021-01-28 02:24:58
问题 I am trying to develop a spring-boot based rest API service with API documentation through Swagger UI. I want to enable basic authentication via the swagger UI so that the user can only run the API's once he/she authenticates using the Authorize button on swagger UI (by which a "authorization: Basic XYZ header is added to the API Call At the front end (in the .json file for the Swagger UI I have added basic authentication for all the APIs using the following code (as per the documentation):

Basic Authentication using Swagger UI

▼魔方 西西 提交于 2021-01-27 22:50:54
问题 I am trying to develop a spring-boot based rest API service with API documentation through Swagger UI. I want to enable basic authentication via the swagger UI so that the user can only run the API's once he/she authenticates using the Authorize button on swagger UI (by which a "authorization: Basic XYZ header is added to the API Call At the front end (in the .json file for the Swagger UI I have added basic authentication for all the APIs using the following code (as per the documentation):

How to send Authorization header with a request in swagger-ui-react?

橙三吉。 提交于 2021-01-27 11:42:23
问题 I use swagger-ui-react in my application. But I don't know how to config to add the authorization into api requests. I had found an answer use in swagger ui from here: window.swaggerUi = new SwaggerUi({...}) ... swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("Authorization", "Basic dXNlcm5hbWU6cGFzc3dvcmQ=", "header")); But I don't know how to use in swagger-ui-react. Here is my code: import styles from './index.less'; import React from 'react'; // tslint

How to send Authorization header with a request in swagger-ui-react?

断了今生、忘了曾经 提交于 2021-01-27 11:41:19
问题 I use swagger-ui-react in my application. But I don't know how to config to add the authorization into api requests. I had found an answer use in swagger ui from here: window.swaggerUi = new SwaggerUi({...}) ... swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("Authorization", "Basic dXNlcm5hbWU6cGFzc3dvcmQ=", "header")); But I don't know how to use in swagger-ui-react. Here is my code: import styles from './index.less'; import React from 'react'; // tslint

How to draw tables using JSON for OpenAPI

[亡魂溺海] 提交于 2021-01-27 07:08:16
问题 I want to make a table in a JSON file I use Swagger UI (2.0) to describe APIs. The opneapi.json is hosted in a Gitlab. The Swagger Spec says that GFM syntax can be used for rich text representation. The Gitlab flavoured Markdown (GFM) syntax for a table includes a "carriage return". But JSON does not handle "carriage return". Is there any workaround to include tables in an openapi.json? 回答1: OpenAPI 2.0 OpenAPI 2.0 uses GitHub Flavored Markdown, which supports the usual Markdown syntax for

Configure Swagger-UI to pick up Spring's HttpSecurity Logout endpoint

岁酱吖の 提交于 2021-01-27 05:52:49
问题 I have Swagger set up and working for all of the controllers listed in my application. However, I want it to pick up the Spring Security Logout Endpoint and I cannot find a way to get it to work. As you can see from code snippet below I am specifying a logoutUrl for a user to invalidate their session. I've tried class level annotation markings and method level, but no luck. Any ideas? @Override public void configure(HttpSecurity http) throws Exception { http.addFilter(someFilter()); http

How to Integrate Open API 3 with Spring project (not Spring Boot) using springdoc-openapi

杀马特。学长 韩版系。学妹 提交于 2021-01-22 13:23:31
问题 My Existing Project is on Spring Framework not Spring Boot. I want to integrate Open API 3 with it. I want to integrate using springdoc-openapi not using Jersey. 回答1: Even your application is using spring without (spring-boot), it should work. You need to add beans and dependencies auto-configuration that are natively provided in spring-boot. You mainly, need to add the springdoc-openapi module and scan for the springdoc auto-configuration classes that spring-boot automatically loads for you.

How to Integrate Open API 3 with Spring project (not Spring Boot) using springdoc-openapi

天涯浪子 提交于 2021-01-22 13:22:11
问题 My Existing Project is on Spring Framework not Spring Boot. I want to integrate Open API 3 with it. I want to integrate using springdoc-openapi not using Jersey. 回答1: Even your application is using spring without (spring-boot), it should work. You need to add beans and dependencies auto-configuration that are natively provided in spring-boot. You mainly, need to add the springdoc-openapi module and scan for the springdoc auto-configuration classes that spring-boot automatically loads for you.

Can't read from file issue in Swagger UI

安稳与你 提交于 2021-01-20 14:50:24
问题 I have incorporated swagger UI in my application. When I try and see the swagger UI, I get the documentation of the API nicely but after some time it shows some error icon at the button. The Error message is like below: [{"level":"error","message":"Can't read from file http://MYIP/swagger/docs/v1"}] I am not sure what is causing it. If I refresh it works and shows error after few seconds. 回答1: I am guessing "http://MYIP/swagger/docs/v1" is not publicly accessible. By default swagger ui uses