Skip to content

Commit 2c08057

Browse files
author
bnasslahsen
committed
F.A.Q update
1 parent b5abb98 commit 2c08057

File tree

5 files changed

+101
-11
lines changed

5 files changed

+101
-11
lines changed

faq.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,14 @@ ResponseEntity<String> testme() {
291291
- Full documentation here:
292292
- [https://docs.spring.io/spring/docs/5.1.x/spring-framework-reference/web.html#mvc-ann-arguments](https://docs.spring.io/spring/docs/5.1.x/spring-framework-reference/web.html#mvc-ann-arguments).
293293

294+
### How can i disable ignored types:
295+
296+
If you don't want to ignore the types `Principal`, `Locale`, `HttpServletRequest`, and others,:
297+
```java
298+
SpringDocUtils.getConfig().removeRequestWrapperToIgnore(HttpServletRequest.class)
299+
```
300+
301+
294302
### How do I add authorization header in requests?
295303
- You should add the `@SecurityRequirement` tags to your protected APIs.
296304
- For example:
@@ -641,7 +649,6 @@ public class AppInitializer implements WebApplicationInitializer {
641649
```
642650

643651
### How can I use enable springdoc-openapi MonetaryAmount support ?
644-
645652
- If an application wants to enable the springdoc-openapi support, it declares:
646653

647654
```java
@@ -656,5 +663,87 @@ SpringDocUtils.getConfig().replaceWithSchema(MonetaryAmount.class, new ObjectSch
656663
.addProperties("currency", new StringSchema().example("USD")));
657664
```
658665

666+
### How can i agreagte external endpoints (exposing OPENAPI 3 spec) inside one single application?
667+
The properties springdoc.swagger-ui.urls.*, are suitable to configure external (/v3/api-docs url).
668+
For example if you want to agreagte all the endpoints of other services, inside one single application.
669+
Don't forget that CORS needs to be enabled as well.
670+
671+
### How can use custom json/yml file instead of generated one ?
672+
If your file open-api.json, contains the OpenAPI documentation in OpenAPI 3 format.
673+
Then simply declare: The file name can be anything you want, from the moment your declaration is consistent yaml or json OpenAPI Spec.
674+
```properties
675+
springdoc.swagger-ui.url=/open-api.json
676+
```
677+
678+
Then the file open-api.json, should be located in: src/main/resources/static
679+
No additional configuration is needed.
680+
681+
### How can i enable CSRF support?
682+
If you are using standard headers.(for example using spring-security headers)
683+
If the CSRF Token is required, swagger-ui automatically sends the new XSRF-TOKEN during each HTTP REQUEST.
684+
That said - if your XSRF-TOKEN isn't standards-based, you can use a requestInterceptor to manually capture and attach the latest xsrf token to requests programmatically via spring resource transformer:
685+
- https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md#requestinterceptor
686+
687+
Starting from release v1.4.4 of springdoc-openapi, a new property is added to enable CSRF support, while using standard header names:
688+
```properties
689+
springdoc.swagger-ui.csrf.enabled=true
690+
```
691+
692+
### How can i disable the default swagger petstore URL?
693+
You can use the following property:
694+
```properties
695+
springdoc.swagger-ui.disable-swagger-default-url=true
696+
```
697+
698+
### Is @PageableDefault supported, to enhance the OpenAPI 3 docuementation?
699+
Yes, you can use it in conjunction with `@ParameterObject` annotation.
700+
Also, the spring-boot `spring.data.web.*` and `spring.data.rest.default.*` properties are supported since v1.4.5
701+
702+
### How can i make spring security login-endpoint visible ?
703+
You can use the following property:
704+
```properties
705+
springdoc.show-login-endpoint=true
706+
```
707+
708+
### How can i show schema definitions even the schema is not referenced?
709+
You can use the following property:
710+
```properties
711+
springdoc.remove-broken-reference-definitions=false
712+
```
713+
714+
### How can i disable the swagger-ui from loading twince?
715+
You can try the following property (if not using Oauth): This resolves a bug on swagger-ui where it loads some resources twice if using configurl as query parameter.
716+
```properties
717+
springdoc.swagger-ui.display-query-params-without-oauth2=true
718+
```
719+
Or if using Oauth2:
720+
```properties
721+
springdoc.swagger-ui.display-query-params = true
722+
```
723+
724+
### How to override @Deprecated?
725+
The whole idea of springdoc-openapi is to get your documentation the closest to the code, with minimal code changes.
726+
If the code contains `@Deprecated`, sprindoc-openapi will consider its schema as Deprecated as well.
727+
If you want to declare a field on swagger as non deprecated, even with the java code, the field contains `@Depreacted`,
728+
You can use the following property that is available since release v1.4.3:
729+
```properties
730+
springdoc.model-converters.deprecating-converter.enabled=false
731+
```
732+
733+
### How can i display a method that returns ModelAndView?
734+
735+
You can use the following property:
736+
```properties
737+
springdoc.model-and-view-allowed=true
738+
```
739+
740+
741+
### How can i have pretty-printed output of the OpenApi specification?
742+
743+
You can use the following property:
744+
```properties
745+
springdoc.writer-with-default-pretty-printer=true
746+
```
747+
659748

660749
[back](./)

index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This is a community-based project, not maintained by the Spring Framework Contri
4141
<dependency>
4242
<groupId>org.springdoc</groupId>
4343
<artifactId>springdoc-openapi-ui</artifactId>
44-
<version>1.4.4</version>
44+
<version>1.4.5</version>
4545
</dependency>
4646
```
4747
* This step is optional: For custom path of the swagger documentation in HTML format, add a custom springdoc property, in your spring-boot configuration file:
@@ -63,7 +63,7 @@ springdoc.swagger-ui.path=/swagger-ui.html
6363
<dependency>
6464
<groupId>org.springdoc</groupId>
6565
<artifactId>springdoc-openapi-webmvc-core</artifactId>
66-
<version>1.4.4</version>
66+
<version>1.4.5</version>
6767
</dependency>
6868
```
6969
* This step is optional: For custom path of the OpenAPI documentation in Json format, add a custom springdoc property, in your spring-boot configuration file:
@@ -136,7 +136,7 @@ springdoc.pathsToMatch=/v1, /api/balance/**
136136
<dependency>
137137
<groupId>org.springdoc</groupId>
138138
<artifactId>springdoc-openapi-webflux-ui</artifactId>
139-
<version>1.4.4</version>
139+
<version>1.4.5</version>
140140
</dependency>
141141
```
142142
* This step is optional: For custom path of the swagger documentation in HTML format, add a custom springdoc property, in your spring-boot configuration file:
@@ -235,7 +235,7 @@ This dependency enables the support of Spring Hateoas format.
235235
<dependency>
236236
<groupId>org.springdoc</groupId>
237237
<artifactId>springdoc-openapi-hateoas</artifactId>
238-
<version>1.4.4</version>
238+
<version>1.4.5</version>
239239
</dependency>
240240
```
241241

@@ -254,7 +254,7 @@ This dependency enables the support of spring-data-rest types as well: @Reposito
254254
<dependency>
255255
<groupId>org.springdoc</groupId>
256256
<artifactId>springdoc-openapi-data-rest</artifactId>
257-
<version>1.4.4</version>
257+
<version>1.4.5</version>
258258
</dependency>
259259
```
260260

@@ -265,7 +265,7 @@ This dependency helps ignoring @AuthenticationPrincipal in case its used on REST
265265
<dependency>
266266
<groupId>org.springdoc</groupId>
267267
<artifactId>springdoc-openapi-security</artifactId>
268-
<version>1.4.4</version>
268+
<version>1.4.5</version>
269269
</dependency>
270270
```
271271

@@ -276,7 +276,7 @@ This dependency improves the support of Kotlin types:
276276
<dependency>
277277
<groupId>org.springdoc</groupId>
278278
<artifactId>springdoc-openapi-kotlin</artifactId>
279-
<version>1.4.4</version>
279+
<version>1.4.5</version>
280280
</dependency>
281281
```
282282
- If your are using spring-web, you combine the springdoc-openapi-kotlin module with springdoc-openapi-ui.
@@ -289,7 +289,7 @@ This dependency improves the support of Kotlin types:
289289
<dependency>
290290
<groupId>org.springdoc</groupId>
291291
<artifactId>springdoc-openapi-groovy</artifactId>
292-
<version>1.4.4</version>
292+
<version>1.4.5</version>
293293
</dependency>
294294
```
295295

migrating-from-springfox.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ layout: default
1010
<dependency>
1111
<groupId>org.springdoc</groupId>
1212
<artifactId>springdoc-openapi-ui</artifactId>
13-
<version>1.4.4</version>
13+
<version>1.4.5</version>
1414
</dependency>
1515
```
1616

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<version>3.1.2-SNAPSHOT</version>
1010

1111
<properties>
12-
<springdoc.version>1.4.4</springdoc.version>
12+
<springdoc.version>1.4.5</springdoc.version>
1313
</properties>
1414

1515
<build>

springdoc-properties.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ springdoc.remove-broken-reference-definitions | `true` | `Boolean`. To disable r
3939
springdoc.writer-with-default-pretty-printer | `false` | `Boolean`. To enable pretty print of the OpenApi specification.
4040
springdoc.model-converters.deprecating-converter.enabled | `true` | `Boolean`. To disable deprecating model converter.
4141
springdoc.use-fqn | `false` | `Boolean`. To enable fully qualified names.
42+
springdoc.show-login-endpoint | `false` | `Boolean`. To make spring security login-endpoint visible.
4243

4344
### swagger-ui properties
4445
- The support of the swagger-ui properties is available on `springdoc-openapi`. See [Official documentation](https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/).

0 commit comments

Comments
 (0)