Skip to content

Commit 0cc0098

Browse files
authored
Merge pull request #3 from springdoc/master
Update
2 parents 41b61fd + 3242617 commit 0cc0098

File tree

368 files changed

+8756
-1513
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

368 files changed

+8756
-1513
lines changed

.travis.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,16 @@ cache:
88

99
addons:
1010
sonarcloud:
11-
organization: "springdoc"
11+
organization: "springdoc-openapi"
12+
token:
13+
secure: "S5zeA+Vvbe7LG450OAtd5TrBRL8fhaWgJjzAp3RzS797++2xrN92jI74h5NL0MiYBd6NKoWql1WJaMKHCfo/EJ6RdExdw71126B2k061iK54y8pxom+ADFigKgkVzHgnV28uBioC2DIcVvRDk8WkX6IZ9I6C72TzWapXrlCnRkSY1lsfOwvqahTYheaDzRKWN5WoBm8M63IiciMz21SSrdm20fjQeY90EI0EfKn0jjJWL8WKmDa98MeSsJWBwR964ICKRvRq9CGTjTZVhL+D0VYt4tS7kpoN9QatL6SL/octL6jXhgGqnFu8AWRwe1RX7hM9jjDLCkXrz6pr9+t4ts8lo7CcG1YmO5A0vRZYvdO9Y98REEAfU17Y21YjWwl2H41BuHGjJ/vSyVQ1ASE4Q7hBdCTJYNVr+PtMIHR6WFuNIBgA23sYvEQhBolnLpVfs3q5CjVwV3r6wx0ubaRkLlv0MTphic/lGQPFfaVdjYpBCKAr+G6k7t8elpMCf1oeVoopGM6y1WRSCmq2nZyf1n9oNXd4BcFvwnaQwQaEAPnTcZw1F4O6Z0Tc5BJOvJ5pQ79d3EJaOGyDJmezKBxV6mgeIH1ILkWc6nKf1JnqE4v8yCdRsvsTAPcIEn66jqTLpo5uvERroodHqNKP9aSbxvyHp8nkSLb35+w8NpRMlEg="
1214

1315
script:
14-
- mvn clean deploy --settings settings.xml
15-
- mvn sonar:sonar -Dsonar.login=$SONAR_TOKEN -DskipTests
16+
- mvn clean package --settings settings.xml
1617

18+
deploy:
19+
provider: script
20+
script: mvn deploy -DskipTests sonar:sonar -Dsonar.projectKey=springdoc_springdoc-openapi --settings settings.xml
21+
on:
22+
branch: master
1723

CHANGELOG.md

Lines changed: 84 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,94 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [Unreleased]
7+
## [Unreleased] -
8+
### Added
9+
- Support for pathsToMatch and packagesToScan to work in spinal-case as well. Fixes #338
10+
## Fixed
11+
- Fixes springdoc.swagger-ui.url property #339
12+
13+
## [1.2.26] -
14+
### Added
15+
- Make springdoc cache configurable #331
16+
### Fixed
17+
- Multiple paths in controller and DeleteMapping generates incorrect Request Body #334
18+
19+
## [1.2.25] -
20+
### Fixed
21+
- Fix double registration of model converters when grouped api is used #324
22+
### Added
23+
- Added support for multiple OpenAPI definitions in spring webflux #329
24+
25+
## [1.2.24] -
26+
### Changed
27+
- Improve beans loading, if projects uses the UI only #321
28+
29+
## [1.2.23] -
30+
### Added
31+
- Added migration guide from springfox #292
32+
- Added support for @JsonViews with spring @requestbody annotation #315
33+
- Provide oauth2RedirectUrl, if not declared #320
34+
### Fixed
35+
- Wrong server url with when grouped api name contains special charater #312
36+
37+
## [1.2.22] -
38+
### Added
39+
- New annotation @PageableAsQueryParam for better Pageable support
40+
- Feature to serve from the same swagger-ui both, REST APIs that are deployed within the same application and external REST APIs #309
41+
- Customizing operations, parameters and properties available through an SPI #293
42+
### Changed
43+
- Autoconfigurations will not be loaded if classpath does not contain mvc/reactive dependencies or application is not web application #299
44+
### Fixed
45+
- Corrected the support of oauth2-redirect.html and oauth2RedirectUrl #311
46+
47+
48+
## [1.2.21] -
49+
### Added
50+
- Springdoc, Callable support #297
51+
### Removed
52+
- Property `springdoc.api-docs.groups.enabled` removed, as not needed any more for enabling multiple OpenAPI definitions support #296
53+
### Changed
54+
- Improve springdoc-openapi beans loading #290 #294
855

9-
### Addded
56+
## [1.2.20] - 2019-12-23
57+
### Changed
58+
- Preserve order of @Parameters for spring-boot 2.2 #289
59+
### Removed
60+
- Remove @EnableWebMvc from SwaggerConfig (not needed for Spring Boot) #236 #150
61+
62+
## [1.2.19] - 2019-12-22
63+
### Added
64+
- Support for Multiple OpenAPI definitions in one Spring Boot #213
65+
- Support for spring-context-indexer #262
66+
- Added support using properties from application.yml for description field in swagger-annotations #231
67+
- Make validatorUrl configurable and fix overwrites #281
68+
- Improve support of HttpEntity. fixes #280
69+
### Changed
70+
- Ignore ServerHttpRequest and ServerHttpResponse Webflux #270
71+
- Preserve order of parameters in @Parameters annotation #274
72+
- Changed the default value if consumes is missing, to MediaType.APPLICATION_JSON_VALUE #275
73+
- Renamed actuator property to springdoc.show-actuator #286
74+
### Fixed
75+
- Static content no longer delivered #246
76+
77+
## [1.2.18] - 2019-12-14
78+
### Added
1079
- Globally exclude params for webflux #228
80+
- Added ability to ignore param with @hidden annotation at class level #255
81+
- Support of spring.mvc.servlet.path #238
82+
- ignore Authentication in controller params #245
83+
- Support for oauth2RedirectUrl #240
84+
- Support of @Hidden at class level. #260
85+
- Ability for using properties from application.yml to declare security urls: (openIdConnectUrl - authorizationUrl - refreshUrl - tokenUrl) #231
86+
- Added support of annotation @Parameters (without @Operation) #241
87+
### Changed
88+
- Downgrade swagger-ui to 3.24.0, fixes #239
89+
### Fixed
90+
- Fixes error with JDK 11 + Kotlin #248
1191

1292
## [1.2.17] - 2019-12-05
13-
### Addded
93+
### Added
1494
- Handle multiple endpoints on @GetParam #219
15-
1695
### Changed
1796
- Upgrade Springboot to 2.2.1
1897
- Upgrade Swagger UI to 3.24.3
@@ -23,10 +102,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
23102
- Add Spring Boot metadata for config properties. #208
24103
- Explicitly set which packages/ paths to scan #210
25104
- Disable the try it out button #214
26-
27105
### Changed
28106
- Changed getOpenApi in AbstractOpenApiResource to synchronized #209
29-
30107
### Fixed
31108
- Missing Response Content - #212
32109

@@ -372,7 +449,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
372449

373450
## [1.0.1] - 2019-07-24
374451
### Added
375-
- Added sample codes
452+
- Added demo applications, sample code
376453

377454
## [1.0.0] - 2019-07-23
378455
### Added

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
[![Build Status](https://travis-ci.org/springdoc/springdoc-openapi.svg?branch=master)](https://travis-ci.org/springdoc/springdoc-openapi)
2-
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=org.springdoc%3Aspringdoc-openapi&metric=alert_status)](https://sonarcloud.io/dashboard?id=org.springdoc%3Aspringdoc-openapi)
2+
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=springdoc_springdoc-openapi&metric=alert_status)](https://sonarcloud.io/dashboard?id=springdoc_springdoc-openapi)
3+
[![Known Vulnerabilities](https://snyk.io/test/github/springdoc/springdoc-openapi.git/badge.svg)](https://snyk.io/test/github/springdoc/springdoc-openapi.git)
34

45
![Octocat](https://springdoc.github.io/springdoc-openapi-demos/images/springdoc-openapi.png)
56

7+
# [Full documentation](https://springdoc.org)
8+
69
# **Introduction**
710

811
The springdoc-openapi Java library helps automating the generation of API documentation using Spring Boot projects.

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.springdoc</groupId>
55
<artifactId>springdoc-openapi</artifactId>
6-
<version>1.2.18-SNAPSHOT</version>
6+
<version>1.2.27-SNAPSHOT</version>
77
<packaging>pom</packaging>
88
<name>Spring openapi documentation generator</name>
99
<description>Spring openapi documentation generator</description>
@@ -70,6 +70,7 @@
7070
<swagger-api.version>2.1.0</swagger-api.version>
7171
<swagger-ui.version>3.24.0</swagger-ui.version>
7272
<webjars-locator.version>0.38</webjars-locator.version>
73+
<spring-security-oauth2.version>2.3.5.RELEASE</spring-security-oauth2.version>
7374
</properties>
7475

7576
<dependencyManagement>
@@ -101,6 +102,11 @@
101102
<artifactId>webjars-locator</artifactId>
102103
<version>${webjars-locator.version}</version>
103104
</dependency>
105+
<dependency>
106+
<groupId>org.springframework.security.oauth</groupId>
107+
<artifactId>spring-security-oauth2</artifactId>
108+
<version>${spring-security-oauth2.version}</version>
109+
</dependency>
104110
</dependencies>
105111
</dependencyManagement>
106112
<dependencies>

springdoc-openapi-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springdoc</groupId>
77
<artifactId>springdoc-openapi</artifactId>
8-
<version>1.2.18-SNAPSHOT</version>
8+
<version>1.2.27-SNAPSHOT</version>
99
</parent>
1010
<dependencies>
1111
<dependency>

springdoc-openapi-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,27 @@
99
import org.slf4j.Logger;
1010
import org.slf4j.LoggerFactory;
1111
import org.springdoc.core.*;
12+
import org.springdoc.core.customizers.OpenApiCustomiser;
1213
import org.springframework.beans.factory.annotation.Value;
1314
import org.springframework.core.annotation.AnnotationUtils;
1415
import org.springframework.util.AntPathMatcher;
1516
import org.springframework.util.CollectionUtils;
17+
import org.springframework.web.bind.annotation.RequestBody;
1618
import org.springframework.web.bind.annotation.RequestMapping;
1719
import org.springframework.web.bind.annotation.RequestMethod;
1820
import org.springframework.web.method.HandlerMethod;
1921

22+
import java.io.UnsupportedEncodingException;
2023
import java.lang.reflect.Method;
24+
import java.net.URLDecoder;
25+
import java.nio.charset.StandardCharsets;
2126
import java.time.Duration;
2227
import java.time.Instant;
2328
import java.util.*;
2429
import java.util.stream.Collectors;
2530
import java.util.stream.Stream;
2631

27-
import static org.springdoc.core.Constants.SPRINGDOC_PACKAGES_TO_SCAN;
28-
import static org.springdoc.core.Constants.SPRINGDOC_PATHS_TO_MATCH;
32+
import static org.springdoc.core.Constants.*;
2933

3034
public abstract class AbstractOpenApiResource {
3135

@@ -41,6 +45,8 @@ public abstract class AbstractOpenApiResource {
4145
private List<String> packagesToScan;
4246
@Value(SPRINGDOC_PATHS_TO_MATCH)
4347
private List<String> pathsToMatch;
48+
@Value(SPRINGDOC_CACHE_DISABLED_VALUE)
49+
private boolean cacheDisabled;
4450

4551
protected AbstractOpenApiResource(OpenAPIBuilder openAPIBuilder, AbstractRequestBuilder requestBuilder,
4652
AbstractResponseBuilder responseBuilder, OperationBuilder operationParser,
@@ -53,9 +59,23 @@ protected AbstractOpenApiResource(OpenAPIBuilder openAPIBuilder, AbstractRequest
5359
this.openApiCustomisers = openApiCustomisers;
5460
}
5561

62+
protected AbstractOpenApiResource(OpenAPIBuilder openAPIBuilder, AbstractRequestBuilder requestBuilder,
63+
AbstractResponseBuilder responseBuilder, OperationBuilder operationParser,
64+
Optional<List<OpenApiCustomiser>> openApiCustomisers, List<String> pathsToMatch, List<String> packagesToScan,boolean cacheDisabled) {
65+
super();
66+
this.openAPIBuilder = openAPIBuilder;
67+
this.requestBuilder = requestBuilder;
68+
this.responseBuilder = responseBuilder;
69+
this.operationParser = operationParser;
70+
this.openApiCustomisers = openApiCustomisers;
71+
this.pathsToMatch = pathsToMatch;
72+
this.packagesToScan = packagesToScan;
73+
this.cacheDisabled=cacheDisabled;
74+
}
75+
5676
protected synchronized OpenAPI getOpenApi() {
5777
OpenAPI openApi;
58-
if (!computeDone) {
78+
if (!computeDone || cacheDisabled) {
5979
Instant start = Instant.now();
6080
openAPIBuilder.build();
6181
Map<String, Object> restControllersMap = openAPIBuilder.getRestControllersMap();
@@ -186,8 +206,8 @@ private void calculateJsonView(io.swagger.v3.oas.annotations.Operation apiOperat
186206
*/
187207
jsonViewAnnotationForRequestBody = (JsonView) Arrays.stream(ReflectionUtils.getParameterAnnotations(method))
188208
.filter(arr -> Arrays.stream(arr)
189-
.anyMatch(annotation -> annotation.annotationType()
190-
.equals(io.swagger.v3.oas.annotations.parameters.RequestBody.class)))
209+
.anyMatch(annotation -> (annotation.annotationType()
210+
.equals(io.swagger.v3.oas.annotations.parameters.RequestBody.class) || annotation.annotationType().equals(RequestBody.class))))
191211
.flatMap(Arrays::stream).filter(annotation -> annotation.annotationType().equals(JsonView.class))
192212
.reduce((a, b) -> null).orElse(jsonViewAnnotation);
193213
}
@@ -276,4 +296,12 @@ protected boolean isPackageToScan(String aPackage) {
276296
protected boolean isPathToMatch(String operationPath) {
277297
return CollectionUtils.isEmpty(pathsToMatch) || pathsToMatch.stream().anyMatch(pattern -> antPathMatcher.match(pattern, operationPath));
278298
}
299+
300+
protected String decode(String requestURI) {
301+
try {
302+
return URLDecoder.decode(requestURI, StandardCharsets.UTF_8.toString());
303+
} catch (UnsupportedEncodingException e) {
304+
return requestURI;
305+
}
306+
}
279307
}

springdoc-openapi-common/src/main/java/org/springdoc/config/SpringDocConfiguration.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

springdoc-openapi-common/src/main/java/org/springdoc/core/AbstractParameterBuilder.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ Parameter buildParameterFromDoc(io.swagger.v3.oas.annotations.Parameter paramete
126126
if (parameterDoc.allowReserved()) {
127127
parameter.setAllowReserved(parameterDoc.allowReserved());
128128
}
129+
setSchema(parameterDoc, components, jsonView, parameter);
130+
setExamples(parameterDoc, parameter);
131+
setExtensions(parameterDoc, parameter);
132+
setParameterStyle(parameter, parameterDoc);
133+
setParameterExplode(parameter, parameterDoc);
134+
135+
return parameter;
136+
}
137+
138+
private void setSchema(io.swagger.v3.oas.annotations.Parameter parameterDoc, Components components, JsonView jsonView, Parameter parameter) {
129139
if (StringUtils.isNotBlank(parameterDoc.ref())) {
130140
parameter.$ref(parameterDoc.ref());
131141
} else {
@@ -144,13 +154,6 @@ Parameter buildParameterFromDoc(io.swagger.v3.oas.annotations.Parameter paramete
144154
}
145155
parameter.setSchema(schema);
146156
}
147-
148-
setExamples(parameterDoc, parameter);
149-
setExtensions(parameterDoc, parameter);
150-
setParameterStyle(parameter, parameterDoc);
151-
setParameterExplode(parameter, parameterDoc);
152-
153-
return parameter;
154157
}
155158

156159
Schema calculateSchema(Components components, java.lang.reflect.Parameter parameter, String paramName,

0 commit comments

Comments
 (0)