Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java Spring OAS3] Minor fixes and general improvements #11229

Merged
merged 17 commits into from
Jan 17, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
{{! RootUriTemplateHandler }}
import org.springframework.boot.web.client.RootUriTemplateHandler;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpRequest;
@@ -704,8 +706,16 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
//Append to finalUri the templatized query string like "?param1={param1Value}&.......
finalUri += "?" + queryUri;
}

String expandedPath = this.expandPath(finalUri, uriParams);
final UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath);

final UriComponentsBuilder builder;
{{! RootUriTemplateHandler }}
if (restTemplate.getUriTemplateHandler() instanceof RootUriTemplateHandler) {
builder = UriComponentsBuilder.fromPath(expandedPath);
} else {
builder = UriComponentsBuilder.fromHttpUrl(basePath).path(expandedPath);
}

URI uri;
try {
Original file line number Diff line number Diff line change
@@ -230,6 +230,14 @@
<artifactId>spring-web</artifactId>
<version>${spring-web-version}</version>
</dependency>

<!-- RootUriTemplateHandler-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.6.2</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1246,10 +1246,6 @@
</property>
</activation>
<modules>
<module>samples/server/petstore/spring-mvc</module>
<module>samples/server/petstore/spring-mvc-default-value</module>
<module>samples/server/petstore/spring-mvc-j8-async</module>
<module>samples/server/petstore/spring-mvc-j8-localdatetime</module>
<!-- clients -->
<module>samples/client/petstore/spring-cloud</module>
<module>samples/openapi3/client/petstore/spring-cloud</module>
@@ -1258,6 +1254,11 @@
<module>samples/client/petstore/spring-stubs</module>
<module>samples/openapi3/client/petstore/spring-stubs</module>
<!-- servers -->
<module>samples/server/petstore/java-camel</module>
<module>samples/server/petstore/spring-mvc</module>
<module>samples/server/petstore/spring-mvc-default-value</module>
<module>samples/server/petstore/spring-mvc-j8-async</module>
<module>samples/server/petstore/spring-mvc-j8-localdatetime</module>
<module>samples/server/petstore/springboot</module>
<module>samples/openapi3/server/petstore/springboot</module>
<module>samples/server/petstore/springboot-beanvalidation</module>