@@ -868,8 +868,7 @@ private void beanValidationForFormatEmail(boolean useBeanValidation, boolean per
868
868
Map <String , File > files = generator .opts (input ).generate ().stream ()
869
869
.collect (Collectors .toMap (File ::getName , Function .identity ()));
870
870
871
- JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("PersonWithEmail.java" ))
872
- .printFileContent ();
871
+ JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("PersonWithEmail.java" ));
873
872
if (useBeanValidation ) javaFileAssert .hasImports ((useJakarta ? "jakarta" : "javax" ) + ".validation.constraints" );
874
873
if (performBeanValidation ) javaFileAssert .hasImports ("org.hibernate.validator.constraints" );
875
874
assertFileContains (Paths .get (outputPath + "/src/main/java/org/openapitools/model/PersonWithEmail.java" ), contains );
@@ -946,6 +945,71 @@ public void shouldGenerateValidCodeForReactiveControllerWithoutParams_issue14907
946
945
.assertMethod ("readAgreements" , "ServerWebExchange" );
947
946
}
948
947
948
+ @ Test
949
+ public void shouldGenerateValidCodeWithPaginated_reactive_issue15265 () throws IOException {
950
+ File output = Files .createTempDirectory ("test" ).toFile ().getCanonicalFile ();
951
+ output .deleteOnExit ();
952
+
953
+ final OpenAPI openAPI = TestUtils .parseFlattenSpec ("src/test/resources/bugs/issue_15265.yaml" );
954
+ final SpringCodegen codegen = new SpringCodegen ();
955
+ codegen .setOpenAPI (openAPI );
956
+ codegen .setOutputDir (output .getAbsolutePath ());
957
+
958
+ codegen .additionalProperties ().put (SpringCodegen .REACTIVE , "true" );
959
+ codegen .additionalProperties ().put (USE_TAGS , "true" );
960
+ codegen .additionalProperties ().put (SpringCodegen .DATE_LIBRARY , "java8" );
961
+ codegen .additionalProperties ().put (INTERFACE_ONLY , "true" );
962
+ codegen .additionalProperties ().put (SKIP_DEFAULT_INTERFACE , "true" );
963
+ codegen .additionalProperties ().put (IMPLICIT_HEADERS , "true" );
964
+ codegen .additionalProperties ().put (OPENAPI_NULLABLE , "false" );
965
+
966
+ ClientOptInput input = new ClientOptInput ();
967
+ input .openAPI (openAPI );
968
+ input .config (codegen );
969
+
970
+ DefaultGenerator generator = new DefaultGenerator ();
971
+
972
+ Map <String , File > files = generator .opts (input ).generate ().stream ()
973
+ .collect (Collectors .toMap (File ::getName , Function .identity ()));
974
+
975
+ JavaFileAssert .assertThat (files .get ("ConsentControllerApi.java" ))
976
+ .assertMethod ("paginated" , "ServerWebExchange" , "Pageable" )
977
+ .toFileAssert ()
978
+ .assertMethod ("paginatedWithParams" , "String" , "ServerWebExchange" , "Pageable" );
979
+ }
980
+
981
+ @ Test
982
+ public void shouldGenerateValidCodeWithPaginated_nonReactive_issue15265 () throws IOException {
983
+ File output = Files .createTempDirectory ("test" ).toFile ().getCanonicalFile ();
984
+ output .deleteOnExit ();
985
+
986
+ final OpenAPI openAPI = TestUtils .parseFlattenSpec ("src/test/resources/bugs/issue_15265.yaml" );
987
+ final SpringCodegen codegen = new SpringCodegen ();
988
+ codegen .setOpenAPI (openAPI );
989
+ codegen .setOutputDir (output .getAbsolutePath ());
990
+
991
+ codegen .additionalProperties ().put (USE_TAGS , "true" );
992
+ codegen .additionalProperties ().put (SpringCodegen .DATE_LIBRARY , "java8" );
993
+ codegen .additionalProperties ().put (INTERFACE_ONLY , "true" );
994
+ codegen .additionalProperties ().put (SKIP_DEFAULT_INTERFACE , "true" );
995
+ codegen .additionalProperties ().put (IMPLICIT_HEADERS , "true" );
996
+ codegen .additionalProperties ().put (OPENAPI_NULLABLE , "false" );
997
+
998
+ ClientOptInput input = new ClientOptInput ();
999
+ input .openAPI (openAPI );
1000
+ input .config (codegen );
1001
+
1002
+ DefaultGenerator generator = new DefaultGenerator ();
1003
+
1004
+ Map <String , File > files = generator .opts (input ).generate ().stream ()
1005
+ .collect (Collectors .toMap (File ::getName , Function .identity ()));
1006
+
1007
+ JavaFileAssert .assertThat (files .get ("ConsentControllerApi.java" ))
1008
+ .assertMethod ("paginated" , "Pageable" )
1009
+ .toFileAssert ()
1010
+ .assertMethod ("paginatedWithParams" , "String" , "Pageable" );
1011
+ }
1012
+
949
1013
@ Test
950
1014
public void shouldEscapeReservedKeyWordsForRequestParameters_7506_Regression () throws Exception {
951
1015
final SpringCodegen codegen = new SpringCodegen ();
@@ -1483,7 +1547,6 @@ public void shouldGenerateExternalDocs() throws IOException {
1483
1547
.collect (Collectors .toMap (File ::getName , Function .identity ()));
1484
1548
1485
1549
JavaFileAssert .assertThat (files .get ("PetApi.java" ))
1486
- .printFileContent ()
1487
1550
.hasImports ("io.swagger.v3.oas.annotations.ExternalDocumentation" )
1488
1551
.assertMethod ("updatePet" )
1489
1552
.assertMethodAnnotations ()
@@ -1831,7 +1894,6 @@ public void shouldGenerateBeanValidationOnHeaderParams() throws IOException {
1831
1894
.collect (Collectors .toMap (File ::getName , Function .identity ()));
1832
1895
1833
1896
JavaFileAssert .assertThat (files .get ("SomeMethodApi.java" ))
1834
- .printFileContent ()
1835
1897
.assertMethod ("methodWithValidation" )
1836
1898
.hasParameter ("headerOne" )
1837
1899
.assertParameterAnnotations ()
@@ -1872,8 +1934,7 @@ public void requiredFieldShouldIncludeNotNullAnnotation_issue13365() throws IOEx
1872
1934
Map <String , File > files = generateFiles (codegen , "src/test/resources/bugs/issue_13365.yml" );
1873
1935
1874
1936
//Assert that NotNull annotation exists alone with no other BeanValidation annotations
1875
- JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("Person.java" ))
1876
- .printFileContent ();
1937
+ JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("Person.java" ));
1877
1938
javaFileAssert .assertMethod ("getName" ).assertMethodAnnotations ()
1878
1939
.containsWithName ("NotNull" ).anyMatch (annotation ->
1879
1940
!annotation .getNameAsString ().equals ("Valid" ) ||
@@ -1904,8 +1965,7 @@ public void requiredFieldShouldIncludeNotNullAnnotationJakarta_issue13365_issue1
1904
1965
Map <String , File > files = generateFiles (codegen , "src/test/resources/bugs/issue_13365.yml" );
1905
1966
1906
1967
//Assert that NotNull annotation exists alone with no other BeanValidation annotations
1907
- JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("Person.java" ))
1908
- .printFileContent ();
1968
+ JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("Person.java" ));
1909
1969
javaFileAssert .assertMethod ("getName" ).assertMethodAnnotations ()
1910
1970
.containsWithName ("NotNull" ).anyMatch (annotation ->
1911
1971
!annotation .getNameAsString ().equals ("Valid" ) ||
@@ -1933,8 +1993,7 @@ public void nonRequiredFieldShouldNotIncludeNotNullAnnotation_issue13365() throw
1933
1993
1934
1994
Map <String , File > files = generateFiles (codegen , "src/test/resources/bugs/issue_13365.yml" );
1935
1995
1936
- JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("Alien.java" ))
1937
- .printFileContent ();
1996
+ JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("Alien.java" ));
1938
1997
javaFileAssert .assertMethod ("getName" )
1939
1998
.assertMethodAnnotations ().anyMatch (annotation -> !annotation .getNameAsString ().equals ("NotNull" ));
1940
1999
javaFileAssert .hasNoImports ("javax.validation.constraints.NotNull" );
@@ -1950,7 +2009,6 @@ public void requiredFieldShouldIncludeNotNullAnnotationWithBeanValidationTrue_is
1950
2009
Map <String , File > files = generateFiles (codegen , "src/test/resources/bugs/issue_14252.yaml" );
1951
2010
1952
2011
JavaFileAssert .assertThat (files .get ("MyResponse.java" ))
1953
- .printFileContent ()
1954
2012
.hasImports ("com.fasterxml.jackson.databind.annotation.JsonSerialize" , "com.fasterxml.jackson.databind.ser.std.ToStringSerializer" )
1955
2013
.assertMethod ("getMyPropTypeNumber" )
1956
2014
.assertMethodAnnotations ()
@@ -1977,8 +2035,7 @@ public void requiredFieldShouldIncludeNotNullAnnotationWithBeanValidationTrue_is
1977
2035
1978
2036
Map <String , File > files = generateFiles (codegen , "src/test/resources/bugs/issue_13365.yml" );
1979
2037
1980
- JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("Person.java" ))
1981
- .printFileContent ();
2038
+ JavaFileAssert javaFileAssert = JavaFileAssert .assertThat (files .get ("Person.java" ));
1982
2039
javaFileAssert .assertMethod ("getName" ).assertMethodAnnotations ()
1983
2040
.containsWithName ("NotNull" ).containsWithName ("Size" ).containsWithName ("javax.validation.constraints.Email" );
1984
2041
javaFileAssert
@@ -2010,7 +2067,6 @@ public void shouldUseEqualsNullableForArrayWhenSetInConfig_issue13385() throws I
2010
2067
.collect (Collectors .toMap (File ::getName , Function .identity ()));
2011
2068
2012
2069
JavaFileAssert .assertThat (files .get ("TestObject.java" ))
2013
- .printFileContent ()
2014
2070
.assertMethod ("equals" )
2015
2071
.bodyContainsLines ("return equalsNullable(this.picture, testObject.picture);" );
2016
2072
@@ -2041,7 +2097,6 @@ public void shouldNotUseEqualsNullableForArrayWhenNotSetInConfig_issue13385() th
2041
2097
.collect (Collectors .toMap (File ::getName , Function .identity ()));
2042
2098
2043
2099
JavaFileAssert .assertThat (files .get ("TestObject.java" ))
2044
- .printFileContent ()
2045
2100
.assertMethod ("equals" )
2046
2101
.bodyContainsLines ("return Arrays.equals(this.picture, testObject.picture);" );
2047
2102
}
@@ -2071,7 +2126,6 @@ public void useBeanValidationGenerateAnnotationsForRequestBody_issue13932() thro
2071
2126
.collect (Collectors .toMap (File ::getName , Function .identity ()));
2072
2127
2073
2128
JavaFileAssert .assertThat (files .get ("AddApi.java" ))
2074
- .printFileContent ()
2075
2129
.assertMethod ("addPost" )
2076
2130
.hasParameter ("body" )
2077
2131
.assertParameterAnnotations ()
0 commit comments