Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/OpenAPIToolsgh-1975-VI' into Ope…
Browse files Browse the repository at this point in the history
…nAPIToolsgh-1975-VI

# Conflicts:
#	bin/spring-all-petstore.sh
#	modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java
  • Loading branch information
nhomble committed Jul 2, 2020
2 parents 169a09d + 2be06bf commit f71c011
Show file tree
Hide file tree
Showing 179 changed files with 721 additions and 2,097 deletions.
8 changes: 8 additions & 0 deletions bin/configs/spring-boot-security-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
generatorName: spring
outputDir: samples/server/petstore/spring-security
library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
useSpringSecurity: true
hideGenerationTimestamp: "true"
32 changes: 0 additions & 32 deletions bin/spring-security-petstore-server.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,16 @@ public void testPreAuthorizeOnOauth() throws IOException {
codegen.additionalProperties().put(SpringCodegen.USE_SPRING_SECURITY, "true");

ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
input.openAPI(openAPI);
input.config(codegen);

DefaultGenerator generator = new DefaultGenerator();

MockDefaultGenerator generator = new MockDefaultGenerator();
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();

String path = outputPath + "/src/main/java/org/openapitools/api/PetsApi.java";
Expand All @@ -661,10 +667,16 @@ public void testPreAuthorizeOnGlobalOauth() throws IOException {
codegen.additionalProperties().put(SpringCodegen.USE_SPRING_SECURITY, "true");

ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
input.openAPI(openAPI);
input.config(codegen);

MockDefaultGenerator generator = new MockDefaultGenerator();
DefaultGenerator generator = new DefaultGenerator();

generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();

String path = outputPath + "/src/main/java/org/openapitools/api/PetsApi.java";
Expand All @@ -687,10 +699,16 @@ public void testDisableSpringSecurityForOauth() throws IOException {
codegen.additionalProperties().put(SpringCodegen.USE_SPRING_SECURITY, "false");

ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
input.openAPI(openAPI);
input.config(codegen);

MockDefaultGenerator generator = new MockDefaultGenerator();
DefaultGenerator generator = new DefaultGenerator();

generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();

String path = outputPath + "/src/main/java/org/openapitools/api/PetsApi.java";
Expand All @@ -713,14 +731,20 @@ public void testPreAuthorizeOnJwtAuth() throws IOException {
codegen.additionalProperties().put(SpringCodegen.USE_SPRING_SECURITY, "true");

ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
input.openAPI(openAPI);
input.config(codegen);

DefaultGenerator generator = new DefaultGenerator();

MockDefaultGenerator generator = new MockDefaultGenerator();
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();

String path = outputPath + "/src/main/java/org/openapitools/api/PetsApi.java";
assertFileContains(Paths.get( path),
assertFileContains(Paths.get(path),
"@PreAuthorize(\"(hasAuthority('scope:another')) or (hasAuthority('scope:specific'))\")");
}

Expand All @@ -739,14 +763,20 @@ public void testDisableSpringSecurityForJwtAuth() throws IOException {
codegen.additionalProperties().put(SpringCodegen.USE_SPRING_SECURITY, "false");

ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
input.openAPI(openAPI);
input.config(codegen);

MockDefaultGenerator generator = new MockDefaultGenerator();
DefaultGenerator generator = new DefaultGenerator();

generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();

String path = outputPath + "/src/main/java/org/openapitools/api/PetsApi.java";
assertFileContains(Paths.get( path),
assertFileNotContains(Paths.get(path),
"@PreAuthorize(\"hasAuthority('scope:another') or hasAuthority('scope:specific')\")");
}

Expand All @@ -765,14 +795,20 @@ public void testPreAuthorizeOnGlobalJwtAuth() throws IOException {
codegen.additionalProperties().put(SpringCodegen.USE_SPRING_SECURITY, "true");

ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
input.openAPI(openAPI);
input.config(codegen);

DefaultGenerator generator = new DefaultGenerator();

MockDefaultGenerator generator = new MockDefaultGenerator();
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();

String path = outputPath + "/src/main/java/org/openapitools/api/PetsApi.java";
assertFileContains(Paths.get( path),
assertFileContains(Paths.get(path),
"@PreAuthorize(\"(hasAuthority('scope:global'))\")");
}

Expand All @@ -791,14 +827,20 @@ public void testTwoOauthScopes() throws IOException {
codegen.additionalProperties().put(SpringCodegen.USE_SPRING_SECURITY, "true");

ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
input.openAPI(openAPI);
input.config(codegen);

MockDefaultGenerator generator = new MockDefaultGenerator();
DefaultGenerator generator = new DefaultGenerator();

generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();

String path = outputPath + "/src/main/java/org/openapitools/api/PetsApi.java";
assertFileContains(Paths.get( path),
assertFileContains(Paths.get(path),
"@PreAuthorize(\"(hasAuthority('user') and hasAuthority('admin'))\")");
}

Expand All @@ -817,14 +859,20 @@ public void noAuth() throws IOException {
codegen.additionalProperties().put(SpringCodegen.USE_SPRING_SECURITY, "true");

ClientOptInput input = new ClientOptInput();
input.setOpenAPI(openAPI);
input.setConfig(codegen);
input.openAPI(openAPI);
input.config(codegen);

MockDefaultGenerator generator = new MockDefaultGenerator();
DefaultGenerator generator = new DefaultGenerator();

generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_TESTS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.MODEL_DOCS, "false");
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
generator.setGeneratorPropertyDefault(CodegenConstants.SUPPORTING_FILES, "false");
generator.opts(input).generate();

String path = outputPath + "/src/main/java/org/openapitools/api/PetsApi.java";
assertFileContains(Paths.get( path),
assertFileContains(Paths.get(path),
"@ApiOperation(value = \"Get the pet\", nickname = \"petsGet\", notes = \"\", tags={ })",
"@ApiResponses(value = { })",
"@RequestMapping(value = \"/pets\",",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0-SNAPSHOT
5.0.0-beta
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0-SNAPSHOT
5.0.0-beta
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0-SNAPSHOT
5.0.0-beta
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.0.0-SNAPSHOT
5.0.0-beta
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-SNAPSHOT).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (5.0.0-beta).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit f71c011

Please sign in to comment.