Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ff031e6
remove @RequestMapping from the apiController.mustache file and add it
Oct 10, 2021
93a8528
move the defaultBasePath.mustache file in src/main/resources/JavaSpring
Oct 10, 2021
d20b07e
added a unit test to verify it
Oct 10, 2021
6436043
update the outputDir variable to samples/server/petstore/spring-stubs in
Oct 10, 2021
6965075
Results of "generate-samples.sh bin/configs/spring*" command
Oct 10, 2021
19410db
Merge branch 'OpenAPITools:master' into fix_issue1928
RomainPruvostMHH Oct 11, 2021
d0d288c
Merge branch 'OpenAPITools:master' into fix_issue1928
RomainPruvostMHH Oct 12, 2021
ed3636f
Remove default value of url in @FeignClient
Oct 12, 2021
14e486b
Merge branch 'master' into fix_issue1928
Oct 13, 2021
3916500
Merge branch 'OpenAPITools:master' into fix_issue1928
RomainPruvostMHH Oct 14, 2021
4fbb8f3
Merge branch 'OpenAPITools:master' into fix_issue1928
RomainPruvostMHH Oct 17, 2021
1e9d54d
Merge branch 'OpenAPITools:master' into fix_issue1928
RomainPruvostMHH Oct 22, 2021
7f0527b
Merge remote-tracking branch 'origin/master' into fix_issue1928
Nov 1, 2021
db439ff
Merge remote-tracking branch 'origin/master' into fix_issue1928
Nov 19, 2021
41d51ca
resolve conflicts with origin/master
Nov 19, 2021
e8a221f
Merge branch 'OpenAPITools:master' into fix_issue1928
RomainPruvostMHH Nov 20, 2021
3c1b8b3
Merge branch 'OpenAPITools:master' into fix_issue1928
RomainPruvostMHH Nov 22, 2021
cb461ca
Merge branch 'OpenAPITools:master' into fix_issue1928
RomainPruvostMHH Nov 25, 2021
88440f5
merge remote/master into branch
Nov 25, 2021
081c3d2
fix samples after a merge with master
Nov 25, 2021
1e70e6a
Merge branch 'OpenAPITools:master' into fix_issue1928
RomainPruvostMHH Nov 26, 2021
2ec5e35
Merge remote-tracking branch 'origin/master' into fix_issue1928
Aug 7, 2022
055dcbd
delete the directory samples/client/petstore/spring-stubs because it
Aug 7, 2022
47ac7f4
add samples/client/petstore/spring-stubs just for the CI build (normally
Aug 7, 2022
bbe9df6
delete 3 kotlin class files commited by error in
Aug 7, 2022
367212b
Update the unit test SpringCodegenTest.doAnnotateDatesOnModelParameters
Aug 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion bin/configs/spring-stubs.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
generatorName: spring
outputDir: samples/client/petstore/spring-stubs
outputDir: samples/server/petstore/spring-stubs
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ import javax.annotation.Generated;
{{#virtualService}}
@VirtualService
{{/virtualService}}
{{=<% %>=}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just be added if NO feign is used.

@RequestMapping("${openapi.<%title%>.base-path:<%>defaultBasePath%>}")
<%={{ }}=%>
public interface {{classname}} {
{{#jdk8-default-interface}}
{{^isDelegate}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@ import javax.annotation.Generated;

{{>generatedAnnotation}}
@Controller
{{=<% %>=}}
@RequestMapping("${openapi.<%title%>.base-path:<%>defaultBasePath%>}")
<%={{ }}=%>
{{#operations}}
public class {{classname}}Controller implements {{classname}} {
{{#isDelegate}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package {{package}};
import org.springframework.cloud.openfeign.FeignClient;
import {{configPackage}}.ClientConfiguration;

@FeignClient(name="${{openbrace}}{{classVarName}}.name:{{classVarName}}{{closebrace}}", {{#useFeignClientUrl}}url="${{openbrace}}{{classVarName}}.url:{{basePath}}{{closebrace}}", {{/useFeignClientUrl}}configuration = ClientConfiguration.class)
{{=<% %>=}}
@FeignClient(name="${<%classVarName%>.name:<%classVarName%>}", url="${<%classVarName%>.url:<%basePath%>}", configuration = ClientConfiguration.class)
<%={{ }}=%>
public interface {{classname}}Client extends {{classname}} {
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ public void doAnnotateDatesOnModelParameters() throws IOException {

JavaFileAssert.assertThat(Paths.get(outputPath + "/src/main/java/org/openapitools/api/ZebrasApi.java"))
.assertTypeAnnotations()
.hasSize(3)
.hasSize(4)
.containsWithName("Validated")
.containsWithName("Generated")
.containsWithName("RequestMapping")
.containsWithNameAndAttributes("Generated", ImmutableMap.of(
"value", "\"org.openapitools.codegen.languages.SpringCodegen\""
))
Expand Down Expand Up @@ -653,6 +654,22 @@ public void testMultipartCloud() throws IOException {
"List<MultipartFile> files",
"MultipartFile file");
}

@Test
public void testRequestMappingAnnotation() throws IOException {
final SpringCodegen codegen = new SpringCodegen();
codegen.setLibrary("spring-boot");

final Map<String, File> files = generateFiles(codegen, "src/test/resources/2_0/petstore.yaml");

// Check that the @RequestMapping annotation is generated in the Api file
final File petApiFile = files.get("PetApi.java");
assertFileContains(petApiFile.toPath(), "@RequestMapping(\"${openapi.openAPIPetstore.base-path:/v2}\")");

// Check that the @RequestMapping annotation is not generated in the Controller file
final File petApiControllerFile = files.get("PetApiController.java");
assertFileNotContains(petApiControllerFile.toPath(), "@RequestMapping(\"${openapi.openAPIPetstore.base-path:/v2}\")");
}

@Test
public void testSettersForConfigValues() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "AbstractService.h"
#include "Arduino.h"



void Tiny::AbstractService::begin(std::string url){
http.begin(String(url.c_str()), test_root_ca); //HTTPS connection
}
28 changes: 28 additions & 0 deletions samples/client/petstore/cpp-tiny/lib/service/AbstractService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef TINY_CPP_CLIENT_ABSTRACTSERVICE_H_
#define TINY_CPP_CLIENT_ABSTRACTSERVICE_H_

#include "HTTPClient.h"
#include "Response.h"
namespace Tiny {

/**
* Class
* Generated with openapi::tiny-cpp-client
*/
class AbstractService {
public:
HTTPClient http;
std::string basepath = "https://petstore3.swagger.io/api/v3"; // TODO: change to your url

void begin(std::string url);

// Go and comment out a certificate in root.cert, if you get an error here
// Certificate from file
const char* test_root_ca =
#include "../../root.cert"
;

}; // end class
}// namespace Tinyclient

#endif /* TINY_CPP_CLIENT_ABSTRACTSERVICE_H_ */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird. There shouldn't be changed to the cp-ting client.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll merge this and clean up the cpp-tiny samples if needed.

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "Pet", description = "Everything about your Pets")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface PetApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "Store", description = "Access to Petstore orders")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface StoreApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "User", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "Default", description = "the Default API")
@RequestMapping("${openapi.apiDocumentation.base-path:}")
public interface DefaultApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "Pet", description = "Everything about your Pets")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface PetApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import org.springframework.cloud.openfeign.FeignClient;
import org.openapitools.configuration.ClientConfiguration;

@FeignClient(name="${pet.name:pet}", configuration = ClientConfiguration.class)
@FeignClient(name="${pet.name:pet}", url="${pet.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class)
public interface PetApiClient extends PetApi {
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "Store", description = "Access to Petstore orders")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface StoreApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import org.springframework.cloud.openfeign.FeignClient;
import org.openapitools.configuration.ClientConfiguration;

@FeignClient(name="${store.name:store}", configuration = ClientConfiguration.class)
@FeignClient(name="${store.name:store}", url="${store.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class)
public interface StoreApiClient extends StoreApi {
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "User", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import org.springframework.cloud.openfeign.FeignClient;
import org.openapitools.configuration.ClientConfiguration;

@FeignClient(name="${user.name:user}", configuration = ClientConfiguration.class)
@FeignClient(name="${user.name:user}", url="${user.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class)
public interface UserApiClient extends UserApi {
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "Pet", description = "Everything about your Pets")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface PetApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "Store", description = "Access to Petstore orders")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface StoreApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "User", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "Pet", description = "Everything about your Pets")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface PetApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "Store", description = "Access to Petstore orders")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface StoreApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "User", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.openapi-generator-ignore
README.md
pom.xml
src/main/java/org/openapitools/api/ApiUtil.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "pet", description = "Everything about your Pets")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface PetApi {

default Optional<NativeWebRequest> getRequest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "store", description = "Access to Petstore orders")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface StoreApi {

default Optional<NativeWebRequest> getRequest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Api(value = "user", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {

default Optional<NativeWebRequest> getRequest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "User", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "User", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "Default", description = "the Default API")
@RequestMapping("${openapi.apiDocumentation.base-path:}")
public interface DefaultApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "AnotherFake", description = "the AnotherFake API")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface AnotherFakeApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "Fake", description = "the Fake API")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface FakeApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "FakeClassnameTags123", description = "the FakeClassnameTags123 API")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface FakeClassnameTags123Api {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "User", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
@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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen")
@Validated
@Tag(name = "User", description = "Operations about user")
@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}")
public interface UserApi {

/**
Expand Down
Loading