Skip to content

Commit 2c6a255

Browse files
authored
Merge pull request #8587 from swagger-api/generators-issue-141
Generators issue 141
2 parents c0183c7 + 33a137f commit 2c6a255

File tree

88 files changed

+1538
-3749
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1538
-3749
lines changed

samples/server/petstore/jaxrs-resteasy/default/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292
<groupId>org.jboss.resteasy</groupId>
9393
<artifactId>jaxrs-api</artifactId>
9494
<version>${resteasy-version}</version>
95-
<scope>provided</scope>
9695
</dependency>
9796
<dependency>
9897
<groupId>org.jboss.resteasy</groupId>

samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/PetApi.java

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,33 +41,41 @@ public class PetApi {
4141

4242
@Consumes({ "application/json", "application/xml" })
4343

44-
@Operation(summary = "Add a new pet to the store", description = "", tags={ "pet" })
44+
@Operation(summary = "Add a new pet to the store", description = "", security = {
45+
@SecurityRequirement(name = "petstore_auth", scopes = {
46+
""
47+
})
48+
}, tags={ "pet" })
4549
@ApiResponses(value = {
4650
@ApiResponse(responseCode = "405", description = "Invalid input") })
47-
public Response addPet(
48-
@Parameter(description = "Pet object that needs to be added to the store" ,required=true) Pet body
49-
,@Context SecurityContext securityContext)
51+
public Response addPet(@Parameter(description = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext)
5052
throws NotFoundException {
5153
return service.addPet(body,securityContext);
5254
}
5355
@DELETE
5456
@Path("/{petId}")
5557

5658

57-
@Operation(summary = "Deletes a pet", description = "", tags={ "pet" })
59+
@Operation(summary = "Deletes a pet", description = "", security = {
60+
@SecurityRequirement(name = "petstore_auth", scopes = {
61+
""
62+
})
63+
}, tags={ "pet" })
5864
@ApiResponses(value = {
5965
@ApiResponse(responseCode = "400", description = "Invalid pet value") })
60-
public Response deletePet( @PathParam("petId") Integer petId,
61-
@Parameter(description = "" )@HeaderParam("api_key") String apiKey
62-
,@Context SecurityContext securityContext)
66+
public Response deletePet( @PathParam("petId") Integer petId,@Parameter(description = "" )@HeaderParam("api_key") String apiKey,@Context SecurityContext securityContext)
6367
throws NotFoundException {
6468
return service.deletePet(petId,apiKey,securityContext);
6569
}
6670
@GET
6771
@Path("/findByStatus")
6872

6973
@Produces({ "application/xml", "application/json" })
70-
@Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings", tags={ "pet" })
74+
@Operation(summary = "Finds Pets by status", description = "Multiple status values can be provided with comma separated strings", security = {
75+
@SecurityRequirement(name = "petstore_auth", scopes = {
76+
""
77+
})
78+
}, tags={ "pet" })
7179
@ApiResponses(value = {
7280
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))),
7381

@@ -80,7 +88,11 @@ public Response findPetsByStatus( @NotNull @QueryParam("status") List<String> s
8088
@Path("/findByTags")
8189

8290
@Produces({ "application/xml", "application/json" })
83-
@Operation(summary = "Finds Pets by tags", description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", tags={ "pet" })
91+
@Operation(summary = "Finds Pets by tags", description = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", security = {
92+
@SecurityRequirement(name = "petstore_auth", scopes = {
93+
""
94+
})
95+
}, tags={ "pet" })
8496
@ApiResponses(value = {
8597
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Pet.class)))),
8698

@@ -93,7 +105,9 @@ public Response findPetsByTags( @NotNull @QueryParam("tags") List<String> tags,
93105
@Path("/{petId}")
94106

95107
@Produces({ "application/xml", "application/json" })
96-
@Operation(summary = "Find pet by ID", description = "Returns a single pet", tags={ "pet" })
108+
@Operation(summary = "Find pet by ID", description = "Returns a single pet", security = {
109+
@SecurityRequirement(name = "api_key")
110+
}, tags={ "pet" })
97111
@ApiResponses(value = {
98112
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Pet.class))),
99113

@@ -108,39 +122,45 @@ public Response getPetById( @PathParam("petId") Integer petId,@Context SecurityC
108122

109123
@Consumes({ "application/json", "application/xml" })
110124

111-
@Operation(summary = "Update an existing pet", description = "", tags={ "pet" })
125+
@Operation(summary = "Update an existing pet", description = "", security = {
126+
@SecurityRequirement(name = "petstore_auth", scopes = {
127+
""
128+
})
129+
}, tags={ "pet" })
112130
@ApiResponses(value = {
113131
@ApiResponse(responseCode = "400", description = "Invalid ID supplied"),
114132

115133
@ApiResponse(responseCode = "404", description = "Pet not found"),
116134

117135
@ApiResponse(responseCode = "405", description = "Validation exception") })
118-
public Response updatePet(
119-
@Parameter(description = "Pet object that needs to be added to the store" ,required=true) Pet body
120-
,@Context SecurityContext securityContext)
136+
public Response updatePet(@Parameter(description = "Pet object that needs to be added to the store" ,required=true) Pet body,@Context SecurityContext securityContext)
121137
throws NotFoundException {
122138
return service.updatePet(body,securityContext);
123139
}
124140
@POST
125141
@Path("/{petId}")
126142
@Consumes({ "application/x-www-form-urlencoded" })
127143

128-
@Operation(summary = "Updates a pet in the store with form data", description = "", tags={ "pet" })
144+
@Operation(summary = "Updates a pet in the store with form data", description = "", security = {
145+
@SecurityRequirement(name = "petstore_auth", scopes = {
146+
""
147+
})
148+
}, tags={ "pet" })
129149
@ApiResponses(value = {
130150
@ApiResponse(responseCode = "405", description = "Invalid input") })
131-
public Response updatePetWithForm( @PathParam("petId") Integer petId,
132-
@Parameter(description = "")@FormParam("name") String name
133-
,
134-
@Parameter(description = "")@FormParam("status") String status
135-
,@Context SecurityContext securityContext)
151+
public Response updatePetWithForm( @PathParam("petId") Integer petId,@Parameter(description = "")@FormParam("name") String name,@Parameter(description = "")@FormParam("status") String status,@Context SecurityContext securityContext)
136152
throws NotFoundException {
137153
return service.updatePetWithForm(petId,name,status,securityContext);
138154
}
139155
@POST
140156
@Path("/{petId}/uploadImage")
141157
@Consumes({ "multipart/form-data" })
142158
@Produces({ "application/json" })
143-
@Operation(summary = "uploads an image", description = "", tags={ "pet" })
159+
@Operation(summary = "uploads an image", description = "", security = {
160+
@SecurityRequirement(name = "petstore_auth", scopes = {
161+
""
162+
})
163+
}, tags={ "pet" })
144164
@ApiResponses(value = {
145165
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = ModelApiResponse.class))) })
146166
public Response uploadFile(MultipartFormDataInput input, @PathParam("petId") Integer petId,@Context SecurityContext securityContext)

samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/PetApiService.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.swagger.api.*;
44
import io.swagger.model.*;
5+
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
56

67
import java.io.File;
78
import io.swagger.model.ModelApiResponse;
@@ -16,20 +17,12 @@
1617
import javax.ws.rs.core.SecurityContext;
1718

1819
public interface PetApiService {
19-
Response addPet(Pet body,SecurityContext securityContext)
20-
throws NotFoundException;
21-
Response deletePet(Integer petId,String apiKey,SecurityContext securityContext)
22-
throws NotFoundException;
23-
Response findPetsByStatus(List<String> status,SecurityContext securityContext)
24-
throws NotFoundException;
25-
Response findPetsByTags(List<String> tags,SecurityContext securityContext)
26-
throws NotFoundException;
27-
Response getPetById(Integer petId,SecurityContext securityContext)
28-
throws NotFoundException;
29-
Response updatePet(Pet body,SecurityContext securityContext)
30-
throws NotFoundException;
31-
Response updatePetWithForm(Integer petId,String name,String status,SecurityContext securityContext)
32-
throws NotFoundException;
33-
Response uploadFile(Integer petId,String additionalMetadata,FormDataContentDisposition fileDetail,SecurityContext securityContext)
34-
throws NotFoundException;
20+
Response addPet(Pet body,SecurityContext securityContext) throws NotFoundException;
21+
Response deletePet(Integer petId,String apiKey,SecurityContext securityContext) throws NotFoundException;
22+
Response findPetsByStatus(List<String> status,SecurityContext securityContext) throws NotFoundException;
23+
Response findPetsByTags(List<String> tags,SecurityContext securityContext) throws NotFoundException;
24+
Response getPetById(Integer petId,SecurityContext securityContext) throws NotFoundException;
25+
Response updatePet(Pet body,SecurityContext securityContext) throws NotFoundException;
26+
Response updatePetWithForm(Integer petId,String name,String status,SecurityContext securityContext) throws NotFoundException;
27+
Response uploadFile(MultipartFormDataInput input,Integer petId,SecurityContext securityContext) throws NotFoundException;
3528
}

samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/StoreApi.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public Response deleteOrder( @PathParam("orderId") String orderId,@Context Secur
5252
@Path("/inventory")
5353

5454
@Produces({ "application/json" })
55-
@Operation(summary = "Returns pet inventories by status", description = "Returns a map of status codes to quantities", tags={ "store" })
55+
@Operation(summary = "Returns pet inventories by status", description = "Returns a map of status codes to quantities", security = {
56+
@SecurityRequirement(name = "api_key")
57+
}, tags={ "store" })
5658
@ApiResponses(value = {
5759
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(array = @ArraySchema(schema = @Schema(implementation = Map.class)))) })
5860
public Response getInventory(@Context SecurityContext securityContext)
@@ -83,9 +85,7 @@ public Response getOrderById( @DecimalMin("1") @DecimalMax("5") @PathParam("orde
8385
@ApiResponse(responseCode = "200", description = "successful operation", content = @Content(schema = @Schema(implementation = Order.class))),
8486

8587
@ApiResponse(responseCode = "400", description = "Invalid Order") })
86-
public Response placeOrder(
87-
@Parameter(description = "order placed for purchasing the pet" ,required=true) Order body
88-
,@Context SecurityContext securityContext)
88+
public Response placeOrder(@Parameter(description = "order placed for purchasing the pet" ,required=true) Order body,@Context SecurityContext securityContext)
8989
throws NotFoundException {
9090
return service.placeOrder(body,securityContext);
9191
}

samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/StoreApiService.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@
1515
import javax.ws.rs.core.SecurityContext;
1616

1717
public interface StoreApiService {
18-
Response deleteOrder(String orderId,SecurityContext securityContext)
19-
throws NotFoundException;
20-
Response getInventory(SecurityContext securityContext)
21-
throws NotFoundException;
22-
Response getOrderById(Integer orderId,SecurityContext securityContext)
23-
throws NotFoundException;
24-
Response placeOrder(Order body,SecurityContext securityContext)
25-
throws NotFoundException;
18+
Response deleteOrder(String orderId,SecurityContext securityContext) throws NotFoundException;
19+
Response getInventory(SecurityContext securityContext) throws NotFoundException;
20+
Response getOrderById(Integer orderId,SecurityContext securityContext) throws NotFoundException;
21+
Response placeOrder(Order body,SecurityContext securityContext) throws NotFoundException;
2622
}

samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/UserApi.java

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ public class UserApi {
4141
@Operation(summary = "Create user", description = "This can only be done by the logged in user.", tags={ "user" })
4242
@ApiResponses(value = {
4343
@ApiResponse(responseCode = "200", description = "successful operation") })
44-
public Response createUser(
45-
@Parameter(description = "Created user object" ,required=true) User body
46-
,@Context SecurityContext securityContext)
44+
public Response createUser(@Parameter(description = "Created user object" ,required=true) User body,@Context SecurityContext securityContext)
4745
throws NotFoundException {
4846
return service.createUser(body,securityContext);
4947
}
@@ -54,9 +52,7 @@ public Response createUser(
5452
@Operation(summary = "Creates list of users with given input array", description = "", tags={ "user" })
5553
@ApiResponses(value = {
5654
@ApiResponse(responseCode = "200", description = "successful operation") })
57-
public Response createUsersWithArrayInput(
58-
@Parameter(description = "List of user object" ,required=true) List<User> body
59-
,@Context SecurityContext securityContext)
55+
public Response createUsersWithArrayInput(@Parameter(description = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext)
6056
throws NotFoundException {
6157
return service.createUsersWithArrayInput(body,securityContext);
6258
}
@@ -67,9 +63,7 @@ public Response createUsersWithArrayInput(
6763
@Operation(summary = "Creates list of users with given input array", description = "", tags={ "user" })
6864
@ApiResponses(value = {
6965
@ApiResponse(responseCode = "200", description = "successful operation") })
70-
public Response createUsersWithListInput(
71-
@Parameter(description = "List of user object" ,required=true) List<User> body
72-
,@Context SecurityContext securityContext)
66+
public Response createUsersWithListInput(@Parameter(description = "List of user object" ,required=true) List<User> body,@Context SecurityContext securityContext)
7367
throws NotFoundException {
7468
return service.createUsersWithListInput(body,securityContext);
7569
}
@@ -134,9 +128,7 @@ public Response logoutUser(@Context SecurityContext securityContext)
134128
@ApiResponse(responseCode = "400", description = "Invalid user supplied"),
135129

136130
@ApiResponse(responseCode = "404", description = "User not found") })
137-
public Response updateUser(
138-
@Parameter(description = "Updated user object" ,required=true) User body
139-
, @PathParam("username") String username,@Context SecurityContext securityContext)
131+
public Response updateUser(@Parameter(description = "Updated user object" ,required=true) User body, @PathParam("username") String username,@Context SecurityContext securityContext)
140132
throws NotFoundException {
141133
return service.updateUser(body,username,securityContext);
142134
}

samples/server/petstore/jaxrs-resteasy/default/src/gen/java/io/swagger/api/UserApiService.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,12 @@
1414
import javax.ws.rs.core.SecurityContext;
1515

1616
public interface UserApiService {
17-
Response createUser(User body,SecurityContext securityContext)
18-
throws NotFoundException;
19-
Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext)
20-
throws NotFoundException;
21-
Response createUsersWithListInput(List<User> body,SecurityContext securityContext)
22-
throws NotFoundException;
23-
Response deleteUser(String username,SecurityContext securityContext)
24-
throws NotFoundException;
25-
Response getUserByName(String username,SecurityContext securityContext)
26-
throws NotFoundException;
27-
Response loginUser(String username,String password,SecurityContext securityContext)
28-
throws NotFoundException;
29-
Response logoutUser(SecurityContext securityContext)
30-
throws NotFoundException;
31-
Response updateUser(User body,String username,SecurityContext securityContext)
32-
throws NotFoundException;
17+
Response createUser(User body,SecurityContext securityContext) throws NotFoundException;
18+
Response createUsersWithArrayInput(List<User> body,SecurityContext securityContext) throws NotFoundException;
19+
Response createUsersWithListInput(List<User> body,SecurityContext securityContext) throws NotFoundException;
20+
Response deleteUser(String username,SecurityContext securityContext) throws NotFoundException;
21+
Response getUserByName(String username,SecurityContext securityContext) throws NotFoundException;
22+
Response loginUser(String username,String password,SecurityContext securityContext) throws NotFoundException;
23+
Response logoutUser(SecurityContext securityContext) throws NotFoundException;
24+
Response updateUser(User body,String username,SecurityContext securityContext) throws NotFoundException;
3325
}

samples/server/petstore/jaxrs-resteasy/default/src/main/java/io/swagger/api/impl/PetApiServiceImpl.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import io.swagger.api.*;
44
import io.swagger.model.*;
5+
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
56

67
import java.io.File;
78
import io.swagger.model.ModelApiResponse;
@@ -18,43 +19,35 @@
1819

1920
@RequestScoped
2021
public class PetApiServiceImpl implements PetApiService {
21-
public Response addPet(Pet body,SecurityContext securityContext)
22-
throws NotFoundException {
22+
public Response addPet(Pet body,SecurityContext securityContext) throws NotFoundException {
2323
// do some magic!
2424
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
2525
}
26-
public Response deletePet(Integer petId,String apiKey,SecurityContext securityContext)
27-
throws NotFoundException {
26+
public Response deletePet(Integer petId,String apiKey,SecurityContext securityContext) throws NotFoundException {
2827
// do some magic!
2928
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
3029
}
31-
public Response findPetsByStatus(List<String> status,SecurityContext securityContext)
32-
throws NotFoundException {
30+
public Response findPetsByStatus(List<String> status,SecurityContext securityContext) throws NotFoundException {
3331
// do some magic!
3432
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
3533
}
36-
public Response findPetsByTags(List<String> tags,SecurityContext securityContext)
37-
throws NotFoundException {
34+
public Response findPetsByTags(List<String> tags,SecurityContext securityContext) throws NotFoundException {
3835
// do some magic!
3936
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
4037
}
41-
public Response getPetById(Integer petId,SecurityContext securityContext)
42-
throws NotFoundException {
38+
public Response getPetById(Integer petId,SecurityContext securityContext) throws NotFoundException {
4339
// do some magic!
4440
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
4541
}
46-
public Response updatePet(Pet body,SecurityContext securityContext)
47-
throws NotFoundException {
42+
public Response updatePet(Pet body,SecurityContext securityContext) throws NotFoundException {
4843
// do some magic!
4944
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
5045
}
51-
public Response updatePetWithForm(Integer petId,String name,String status,SecurityContext securityContext)
52-
throws NotFoundException {
46+
public Response updatePetWithForm(Integer petId,String name,String status,SecurityContext securityContext) throws NotFoundException {
5347
// do some magic!
5448
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
5549
}
56-
public Response uploadFile(Integer petId,String additionalMetadata,FormDataContentDisposition fileDetail,SecurityContext securityContext)
57-
throws NotFoundException {
50+
public Response uploadFile(MultipartFormDataInput input,Integer petId,SecurityContext securityContext) throws NotFoundException {
5851
// do some magic!
5952
return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
6053
}

0 commit comments

Comments
 (0)