Skip to content

Commit 725aae2

Browse files
committed
Upgraded Spring Boot to 3.5
1 parent 2c7efda commit 725aae2

File tree

14 files changed

+213
-225
lines changed

14 files changed

+213
-225
lines changed

modules/openapi-generator-online/pom.xml

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<packaging>jar</packaging>
1313
<name>openapi-generator-online</name>
1414
<properties>
15-
<spring-boot.version>2.5.14</spring-boot.version>
16-
<springfox-version>3.0.0</springfox-version>
15+
<spring-boot.version>3.5.7</spring-boot.version>
16+
<springdoc-version>2.8.14</springdoc-version>
1717
<sonar.exclusions>**/org/openapitools/codegen/online/**/*</sonar.exclusions>
1818
</properties>
1919
<dependencyManagement>
@@ -46,13 +46,27 @@
4646
</resource>
4747
</resources>
4848
<plugins>
49+
<plugin>
50+
<groupId>org.apache.maven.plugins</groupId>
51+
<artifactId>maven-compiler-plugin</artifactId>
52+
<configuration>
53+
<parameters>true</parameters>
54+
</configuration>
55+
</plugin>
4956
<plugin>
5057
<groupId>org.apache.maven.plugins</groupId>
5158
<artifactId>maven-checkstyle-plugin</artifactId>
5259
<configuration>
5360
<configLocation>${project.parent.basedir}${file.separator}google_checkstyle.xml</configLocation>
5461
</configuration>
5562
</plugin>
63+
<plugin>
64+
<groupId>org.apache.maven.plugins</groupId>
65+
<artifactId>maven-surefire-plugin</artifactId>
66+
<configuration>
67+
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
68+
</configuration>
69+
</plugin>
5670
<plugin>
5771
<groupId>org.springframework.boot</groupId>
5872
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -101,25 +115,11 @@
101115
<groupId>org.springframework.boot</groupId>
102116
<artifactId>spring-boot-starter-web</artifactId>
103117
</dependency>
104-
<!--SpringFox dependencies -->
118+
<!--SpringDoc dependencies -->
105119
<dependency>
106-
<groupId>io.springfox</groupId>
107-
<artifactId>springfox-swagger2</artifactId>
108-
<version>${springfox-version}</version>
109-
<exclusions>
110-
<exclusion>
111-
<groupId>io.swagger</groupId>
112-
<artifactId>swagger-annotations</artifactId>
113-
</exclusion>
114-
<exclusion>
115-
<groupId>io.swagger</groupId>
116-
<artifactId>swagger-models</artifactId>
117-
</exclusion>
118-
<exclusion>
119-
<groupId>com.google.guava</groupId>
120-
<artifactId>guava</artifactId>
121-
</exclusion>
122-
</exclusions>
120+
<groupId>org.springdoc</groupId>
121+
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
122+
<version>${springdoc-version}</version>
123123
</dependency>
124124

125125
<!-- Bean Validation API support -->
@@ -133,12 +133,6 @@
133133
<version>${project.parent.version}</version>
134134
</dependency>
135135

136-
<dependency>
137-
<groupId>org.junit.jupiter</groupId>
138-
<artifactId>junit-jupiter-api</artifactId>
139-
<version>${junit.version}</version>
140-
<scope>test</scope>
141-
</dependency>
142136
<dependency>
143137
<groupId>org.springframework.boot</groupId>
144138
<artifactId>spring-boot-starter-test</artifactId>

modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/OpenAPI2SpringBoot.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ public WebMvcConfigurer corsConfigurer() {
5757
return new WebMvcConfigurer() {
5858
@Override
5959
public void addCorsMappings(CorsRegistry registry) {
60-
registry.addMapping("/**").allowedOrigins("*").allowedHeaders("Content-Type");
60+
registry.addMapping("/**")
61+
.allowedOriginPatterns("*")
62+
.allowedHeaders("Content-Type");
6163
}
6264
};
6365
}

modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiOriginFilter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717

1818
package org.openapitools.codegen.online.api;
1919

20-
import javax.servlet.*;
21-
import javax.servlet.http.HttpServletResponse;
20+
import jakarta.servlet.*;
21+
import jakarta.servlet.http.HttpServletResponse;
2222
import java.io.IOException;
2323

2424

25-
public class ApiOriginFilter implements javax.servlet.Filter {
25+
public class ApiOriginFilter implements jakarta.servlet.Filter {
2626
@Override
2727
public void doFilter(ServletRequest request, ServletResponse response,
2828
FilterChain chain) throws IOException, ServletException {

modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import org.springframework.web.context.request.NativeWebRequest;
2121

22-
import javax.servlet.http.HttpServletResponse;
22+
import jakarta.servlet.http.HttpServletResponse;
2323
import java.io.IOException;
2424

2525
public class ApiUtil {

modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApi.java

Lines changed: 71 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,94 +22,122 @@
2222
*/
2323
package org.openapitools.codegen.online.api;
2424

25-
import io.swagger.annotations.*;
25+
import io.swagger.v3.oas.annotations.Operation;
26+
import io.swagger.v3.oas.annotations.Parameter;
27+
import io.swagger.v3.oas.annotations.media.Content;
28+
import io.swagger.v3.oas.annotations.media.ExampleObject;
29+
import io.swagger.v3.oas.annotations.media.Schema;
30+
import io.swagger.v3.oas.annotations.parameters.RequestBody;
31+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
32+
import io.swagger.v3.oas.annotations.responses.ApiResponses;
33+
import io.swagger.v3.oas.annotations.tags.Tag;
2634
import org.openapitools.codegen.CliOption;
2735
import org.openapitools.codegen.online.model.GeneratorInput;
2836
import org.openapitools.codegen.online.model.ResponseCode;
2937
import org.springframework.core.io.Resource;
3038
import org.springframework.http.ResponseEntity;
39+
import org.springframework.web.bind.annotation.GetMapping;
3140
import org.springframework.web.bind.annotation.PathVariable;
32-
import org.springframework.web.bind.annotation.RequestBody;
33-
import org.springframework.web.bind.annotation.RequestMapping;
34-
import org.springframework.web.bind.annotation.RequestMethod;
35-
import org.springframework.web.multipart.MultipartFile;
41+
import org.springframework.web.bind.annotation.PostMapping;
3642

37-
import javax.validation.Valid;
43+
import jakarta.validation.Valid;
3844
import java.util.List;
3945
import java.util.Map;
4046

41-
@Api(value = "gen", description = "the gen API")
47+
@Tag(name = "clients", description = "Client generation APIs")
48+
@Tag(name = "servers", description = "Server generation APIs")
4249
public interface GenApi {
4350
GenApiDelegate getDelegate();
4451

45-
@ApiOperation(value = "Gets languages supported by the client generator", nickname = "clientOptions", notes = "", response = String.class, responseContainer = "List", tags = {"clients",})
52+
@Operation(summary = "Gets languages supported by the client generator", operationId = "clientOptions", tags = {"clients"})
4653
@ApiResponses(value = {
47-
@ApiResponse(code = 200, message = "successful operation", response = String.class, responseContainer = "List")})
48-
@RequestMapping(value = "/gen/clients",
49-
method = RequestMethod.GET)
54+
@ApiResponse(responseCode = "200", description = "successful operation")})
55+
@GetMapping("/gen/clients")
5056
default ResponseEntity<List<String>> clientOptions() {
5157
return getDelegate().clientOptions();
5258
}
5359

5460

55-
@ApiOperation(value = "Downloads a pre-generated file", nickname = "downloadFile", notes = "A valid `fileId` is generated by the `/clients/{language}` or `/servers/{language}` POST operations. The fileId code can be used just once, after which a new `fileId` will need to be requested.", response = MultipartFile.class, tags = {"clients", "servers",})
61+
@Operation(summary = "Downloads a pre-generated file", operationId = "downloadFile", description = "A valid `fileId` is generated by the `/clients/{language}` or `/servers/{language}` POST operations. The fileId code can be used just once, after which a new `fileId` will need to be requested.", tags = {"clients", "servers"})
5662
@ApiResponses(value = {
57-
@ApiResponse(code = 200, message = "successful operation", response = MultipartFile.class)})
58-
@RequestMapping(value = "/gen/download/{fileId}",
59-
produces = {"application/octet-stream"},
60-
method = RequestMethod.GET)
61-
default ResponseEntity<Resource> downloadFile(@ApiParam(value = "", required = true) @PathVariable("fileId") String fileId) {
63+
@ApiResponse(responseCode = "200", description = "successful operation")})
64+
@GetMapping(value = "/gen/download/{fileId}",
65+
produces = {"application/octet-stream"})
66+
default ResponseEntity<Resource> downloadFile(@Parameter(description = "", required = true) @PathVariable String fileId) {
6267
return getDelegate().downloadFile(fileId);
6368
}
6469

6570

66-
@ApiOperation(value = "Generates a client library", nickname = "generateClient", notes = "Accepts a `GeneratorInput` options map for spec location and generation options", response = ResponseCode.class, tags = {"clients",})
71+
@Operation(summary = "Generates a client library", operationId = "generateClient", description = "Accepts a `GeneratorInput` options map for spec location and generation options", tags = {"clients"})
6772
@ApiResponses(value = {
68-
@ApiResponse(code = 200, message = "successful operation", response = ResponseCode.class)})
69-
@RequestMapping(value = "/gen/clients/{language}",
70-
method = RequestMethod.POST)
71-
default ResponseEntity<ResponseCode> generateClient(@ApiParam(value = "The target language for the client library", required = true) @PathVariable("language") String language, @ApiParam(value = "Configuration for building the client library", required = true) @Valid @RequestBody GeneratorInput generatorInput) {
73+
@ApiResponse(responseCode = "200", description = "successful operation")})
74+
@PostMapping(value = "/gen/clients/{language}", consumes = "application/json", produces = "application/json")
75+
default ResponseEntity<ResponseCode> generateClient(
76+
@Parameter(description = "The target language for the client library", required = true, example = "java")
77+
@PathVariable String language,
78+
@RequestBody(description = "Configuration for building the client library", required = true,
79+
content = @Content(mediaType = "application/json",
80+
schema = @Schema(implementation = GeneratorInput.class),
81+
examples = {
82+
@ExampleObject(name = "Basic Example",
83+
summary = "Basic client generation with OpenAPI URL",
84+
value = "{\"openAPIUrl\": \"https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml\", \"options\": {\"packageName\": \"com.example.client\", \"clientPackage\": \"com.example.client\"}}"),
85+
@ExampleObject(name = "With Options",
86+
summary = "Client generation with additional options",
87+
value = "{\"openAPIUrl\": \"https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml\", \"options\": {\"packageName\": \"com.example.petstore\", \"clientPackage\": \"com.example.petstore.client\", \"groupId\": \"com.example\", \"artifactId\": \"petstore-client\", \"artifactVersion\": \"1.0.0\"}}")
88+
}))
89+
@Valid GeneratorInput generatorInput) {
7290
return getDelegate().generateClient(language, generatorInput);
7391
}
7492

7593

76-
@ApiOperation(value = "Generates a server library", nickname = "generateServerForLanguage", notes = "Accepts a `GeneratorInput` options map for spec location and generation options.", response = ResponseCode.class, tags = {"servers",})
94+
@Operation(summary = "Generates a server library", operationId = "generateServerForLanguage", description = "Accepts a `GeneratorInput` options map for spec location and generation options.", tags = {"servers"})
7795
@ApiResponses(value = {
78-
@ApiResponse(code = 200, message = "successful operation", response = ResponseCode.class)})
79-
@RequestMapping(value = "/gen/servers/{framework}",
80-
method = RequestMethod.POST)
81-
default ResponseEntity<ResponseCode> generateServerForLanguage(@ApiParam(value = "framework", required = true) @PathVariable("framework") String framework, @ApiParam(value = "parameters", required = true) @Valid @RequestBody GeneratorInput generatorInput) {
96+
@ApiResponse(responseCode = "200", description = "successful operation")})
97+
@PostMapping(value = "/gen/servers/{framework}", consumes = "application/json", produces = "application/json")
98+
default ResponseEntity<ResponseCode> generateServerForLanguage(
99+
@Parameter(description = "The target server framework", required = true, example = "spring")
100+
@PathVariable String framework,
101+
@RequestBody(description = "Configuration for building the server library", required = true,
102+
content = @Content(mediaType = "application/json",
103+
schema = @Schema(implementation = GeneratorInput.class),
104+
examples = {
105+
@ExampleObject(name = "Basic Example",
106+
summary = "Basic server generation with OpenAPI URL",
107+
value = "{\"openAPIUrl\": \"https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml\", \"options\": {\"packageName\": \"com.example.server\", \"basePackage\": \"com.example.server\"}}"),
108+
@ExampleObject(name = "Spring Boot Server",
109+
summary = "Spring Boot server generation with options",
110+
value = "{\"openAPIUrl\": \"https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml\", \"options\": {\"packageName\": \"com.example.petstore.server\", \"basePackage\": \"com.example.petstore\", \"groupId\": \"com.example\", \"artifactId\": \"petstore-server\", \"artifactVersion\": \"1.0.0\"}}")
111+
}))
112+
@Valid GeneratorInput generatorInput) {
82113
return getDelegate().generateServerForLanguage(framework, generatorInput);
83114
}
84115

85116

86-
@ApiOperation(value = "Returns options for a client library", nickname = "getClientOptions", notes = "", tags = {"clients",})
117+
@Operation(summary = "Returns options for a client library", operationId = "getClientOptions", tags = {"clients"})
87118
@ApiResponses(value = {
88-
@ApiResponse(code = 200, message = "successful operation")})
89-
@RequestMapping(value = "/gen/clients/{language}",
90-
produces = {"application/json"},
91-
method = RequestMethod.GET)
92-
default ResponseEntity<Map<String, CliOption>> getClientOptions(@ApiParam(value = "The target language for the client library", required = true) @PathVariable("language") String language) {
119+
@ApiResponse(responseCode = "200", description = "successful operation")})
120+
@GetMapping(value = "/gen/clients/{language}",
121+
produces = {"application/json"})
122+
default ResponseEntity<Map<String, CliOption>> getClientOptions(@Parameter(description = "The target language for the client library", required = true) @PathVariable String language) {
93123
return getDelegate().getClientOptions(language);
94124
}
95125

96126

97-
@ApiOperation(value = "Returns options for a server framework", nickname = "getServerOptions", notes = "", tags = {"servers",})
127+
@Operation(summary = "Returns options for a server framework", operationId = "getServerOptions", tags = {"servers"})
98128
@ApiResponses(value = {
99-
@ApiResponse(code = 200, message = "successful operation")})
100-
@RequestMapping(value = "/gen/servers/{framework}",
101-
produces = {"application/json"},
102-
method = RequestMethod.GET)
103-
default ResponseEntity<Map<String, CliOption>> getServerOptions(@ApiParam(value = "The target language for the server framework", required = true) @PathVariable("framework") String framework) {
129+
@ApiResponse(responseCode = "200", description = "successful operation")})
130+
@GetMapping(value = "/gen/servers/{framework}",
131+
produces = {"application/json"})
132+
default ResponseEntity<Map<String, CliOption>> getServerOptions(@Parameter(description = "The target language for the server framework", required = true) @PathVariable String framework) {
104133
return getDelegate().getServerOptions(framework);
105134
}
106135

107136

108-
@ApiOperation(value = "Gets languages supported by the server generator", nickname = "serverOptions", notes = "", response = String.class, responseContainer = "List", tags = {"servers",})
137+
@Operation(summary = "Gets languages supported by the server generator", operationId = "serverOptions", tags = {"servers"})
109138
@ApiResponses(value = {
110-
@ApiResponse(code = 200, message = "successful operation", response = String.class, responseContainer = "List")})
111-
@RequestMapping(value = "/gen/servers",
112-
method = RequestMethod.GET)
139+
@ApiResponse(responseCode = "200", description = "successful operation")})
140+
@GetMapping("/gen/servers")
113141
default ResponseEntity<List<String>> serverOptions() {
114142
return getDelegate().serverOptions();
115143
}

modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApiController.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
package org.openapitools.codegen.online.api;
1919

20-
import org.springframework.beans.factory.annotation.Autowired;
2120
import org.springframework.stereotype.Controller;
2221
import org.springframework.web.bind.annotation.RequestMapping;
2322

@@ -27,7 +26,6 @@ public class GenApiController implements GenApi {
2726

2827
private final GenApiDelegate delegate;
2928

30-
@Autowired
3129
public GenApiController(GenApiDelegate delegate) {
3230
this.delegate = delegate;
3331
}

0 commit comments

Comments
 (0)