File tree Expand file tree Collapse file tree
modules/openapi-generator/src
main/resources/Java/libraries/rest-assured
java/org/openapitools/codegen/java Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ import io.swagger.v3.oas.annotations.enums.*;
3030import io.swagger.v3.oas.annotations.media.*;
3131import io.swagger.v3.oas.annotations.responses.*;
3232import io.swagger.v3.oas.annotations.security.*;
33+ import io.swagger.v3.oas.annotations.tags.*;
3334{ {/swagger2AnnotationLibrary} }
3435
3536{ {#useBeanValidation} }
Original file line number Diff line number Diff line change @@ -4536,5 +4536,26 @@ public void testUseDeductionForOneInterfaces() {
45364536
45374537 }
45384538
4539+ @ Test
4540+ public void testSwagger2TagImportRestAssured () throws IOException {
4541+ final Map <String , File > files = generateFromContract (
4542+ "src/test/resources/3_0/petstore.yaml" ,
4543+ JavaClientCodegen .REST_ASSURED ,
4544+ Map .of (ANNOTATION_LIBRARY , "swagger2" )
4545+ );
4546+
4547+ // find the generated API file
4548+ File apiFile = files .values ().stream ()
4549+ .filter (f -> f .getName ().endsWith ("Api.java" ))
4550+ .findFirst ()
4551+ .orElseThrow (() -> new AssertionError ("No API file generated" ));
4552+
4553+ String content = Files .readString (apiFile .toPath ());
4554+
4555+ // verify tags import is present when swagger2 is used with rest-assured
4556+ assertThat (content )
4557+ .contains ("import io.swagger.v3.oas.annotations.tags.*;" )
4558+ .contains ("@Tag(" );
4559+ }
45394560
45404561}
Original file line number Diff line number Diff line change 1+ openapi : 3.0.3
2+ info :
3+ title : Test API
4+ version : 1.0.0
5+ tags :
6+ - name : pets
7+ description : Pet operations
8+ paths :
9+ /pets :
10+ get :
11+ tags :
12+ - pets
13+ operationId : listPets
14+ summary : List all pets
15+ responses :
16+ ' 200 ' :
17+ description : OK
You can’t perform that action at this time.
0 commit comments