[Spring] Fix generated api ignore basePath (#10573)

* remove @RequestMapping from the apiController.mustache file and add it
to the api.mustache file

* move the defaultBasePath.mustache file in src/main/resources/JavaSpring
so that it commun with all Spring server-side libraries (spring-boot,
spring-mvc). The value of default context path is the value of
contextPath variable.

* added a unit test to verify it

* update the outputDir variable to samples/server/petstore/spring-stubs in
the  bin/configs/spring-stubs.yaml file because it generates Spring
server-side classes. And not on the client-side as the output directory
seemed to suggest.

* Results of "generate-samples.sh bin/configs/spring*" command

* Remove default value of url in @FeignClient

* resolve conflicts with origin/master

* merge remote/master into branch

* fix samples after a merge with master

* delete the directory samples/client/petstore/spring-stubs because it
moved to samples/openapi3/...

* add samples/client/petstore/spring-stubs just for the CI build (normally
it is unnecessary))

* delete 3 kotlin class files commited by error in
samples/server/petstore/kotlin-springboot and
samples/server/petstore/kotlin-springboot-reactive

* Update the unit test SpringCodegenTest.doAnnotateDatesOnModelParameters
because one more annotation is generated (@RequestMapping)

Co-authored-by: rpruvost <rpruvost@ITEM-S78402.emea.msad.sopra>
Co-authored-by: rpruvost <rpruvost@ITEM-S78402>
Co-authored-by: rpruvost <rpruvost>
This commit is contained in:
RomainPruvostMHH
2022-08-08 09:43:23 +02:00
committed by GitHub
parent 3c4948ac08
commit 032e1a42d6
325 changed files with 2382 additions and 134 deletions

View File

@@ -32,6 +32,7 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "another-fake", description = "the another-fake API")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface AnotherFakeApi {
default Optional<NativeWebRequest> getRequest() {

View File

@@ -28,7 +28,6 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public class AnotherFakeApiController implements AnotherFakeApi {
private final NativeWebRequest request;

View File

@@ -42,6 +42,7 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "fake", description = "the fake API")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface FakeApi {
default Optional<NativeWebRequest> getRequest() {

View File

@@ -38,7 +38,6 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public class FakeApiController implements FakeApi {
private final NativeWebRequest request;

View File

@@ -32,6 +32,7 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "fake_classname_test", description = "the fake_classname_test API")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface FakeClassnameTestApi {
default Optional<NativeWebRequest> getRequest() {

View File

@@ -28,7 +28,6 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public class FakeClassnameTestApiController implements FakeClassnameTestApi {
private final NativeWebRequest request;

View File

@@ -34,6 +34,7 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "pet", description = "Everything about your Pets")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface PetApi {
default Optional<NativeWebRequest> getRequest() {

View File

@@ -30,7 +30,6 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public class PetApiController implements PetApi {
private final NativeWebRequest request;

View File

@@ -33,6 +33,7 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "store", description = "Access to Petstore orders")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface StoreApi {
default Optional<NativeWebRequest> getRequest() {

View File

@@ -29,7 +29,6 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public class StoreApiController implements StoreApi {
private final NativeWebRequest request;

View File

@@ -34,6 +34,7 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "user", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {
default Optional<NativeWebRequest> getRequest() {

View File

@@ -30,7 +30,6 @@ import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Controller
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public class UserApiController implements UserApi {
private final NativeWebRequest request;