Generate java-pkmst (#223)

This commit is contained in:
Jérémie Bresson 2018-04-25 07:01:48 +02:00 committed by GitHub
parent 6f28209ccc
commit 4924b4951c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 42 additions and 133 deletions

View File

@ -1,11 +1,11 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):

View File

@ -1 +1 @@
2.3.1-SNAPSHOT
3.0.0-SNAPSHOT

View File

@ -50,7 +50,7 @@ will be enabled.
inside the swagger codegen maven plugin under the configuration section
<configuration>
<inputSpec>product-swagger.yaml</inputSpec>
<inputSpec>product-openapi.yaml</inputSpec>
<language>pkmst</language>
<output>${project.build.directory}/generated-sources</output>
<configOptions>

View File

@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by the swagger code generator program (2.3.1-SNAPSHOT).
* NOTE: This class is auto generated by the swagger code generator program (3.0.0-SNAPSHOT).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
@ -40,10 +40,9 @@ public interface PetApi {
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/pet",
produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" },
method = RequestMethod.POST)
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet pet, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = {
@ -55,7 +54,6 @@ public interface PetApi {
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid pet value") })
@RequestMapping(value = "/pet/{petId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE)
ResponseEntity<Void> deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ -114,10 +112,9 @@ public interface PetApi {
@ApiResponse(code = 404, message = "Pet not found"),
@ApiResponse(code = 405, message = "Validation exception") })
@RequestMapping(value = "/pet",
produces = { "application/xml", "application/json" },
consumes = { "application/json", "application/xml" },
method = RequestMethod.PUT)
ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet pet, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = {
@ -129,7 +126,6 @@ public interface PetApi {
@ApiResponses(value = {
@ApiResponse(code = 405, message = "Invalid input") })
@RequestMapping(value = "/pet/{petId}",
produces = { "application/xml", "application/json" },
consumes = { "application/x-www-form-urlencoded" },
method = RequestMethod.POST)
ResponseEntity<Void> updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;

View File

@ -34,7 +34,7 @@ public class PetApiController implements PetApi {
this.objectMapper = objectMapper;
}
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body,
public ResponseEntity<Void> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet pet,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
@ -50,52 +50,22 @@ public class PetApiController implements PetApi {
public ResponseEntity<List<Pet>> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List<String> status,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<List<Pet>>(objectMapper.readValue("", List.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<List<Pet>>(objectMapper.readValue("", List.class), HttpStatus.OK);
}
return new ResponseEntity<List<Pet>>(HttpStatus.OK);
}
public ResponseEntity<List<Pet>> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<List<Pet>>(objectMapper.readValue("", List.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<List<Pet>>(objectMapper.readValue("", List.class), HttpStatus.OK);
}
return new ResponseEntity<List<Pet>>(HttpStatus.OK);
}
public ResponseEntity<Pet> getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<Pet>(objectMapper.readValue("", Pet.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<Pet>(objectMapper.readValue("", Pet.class), HttpStatus.OK);
}
return new ResponseEntity<Pet>(HttpStatus.OK);
}
public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body,
public ResponseEntity<Void> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet pet,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
@ -114,11 +84,6 @@ public class PetApiController implements PetApi {
@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<ModelApiResponse>(objectMapper.readValue("", ModelApiResponse.class), HttpStatus.OK);
}
return new ResponseEntity<ModelApiResponse>(HttpStatus.OK);
}

View File

@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by the swagger code generator program (2.3.1-SNAPSHOT).
* NOTE: This class is auto generated by the swagger code generator program (3.0.0-SNAPSHOT).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
@ -35,7 +35,6 @@ public interface StoreApi {
@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Order not found") })
@RequestMapping(value = "/store/order/{orderId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE)
ResponseEntity<Void> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("orderId") String orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ -59,7 +58,7 @@ public interface StoreApi {
@RequestMapping(value = "/store/order/{orderId}",
produces = { "application/xml", "application/json" },
method = RequestMethod.GET)
ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true, allowableValues="{min=1, max=5}" ) @PathVariable("orderId") Long orderId, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", })
@ -69,6 +68,6 @@ public interface StoreApi {
@RequestMapping(value = "/store/order",
produces = { "application/xml", "application/json" },
method = RequestMethod.POST)
ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order order, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
}

View File

@ -41,43 +41,18 @@ public class StoreApiController implements StoreApi {
public ResponseEntity<Map<String, Integer>> getInventory(@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<Map<String, Integer>>(objectMapper.readValue("", Map.class), HttpStatus.OK);
}
return new ResponseEntity<Map<String, Integer>>(HttpStatus.OK);
}
public ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId,
public ResponseEntity<Order> getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true, allowableValues="{min=1, max=5}" ) @PathVariable("orderId") Long orderId,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<Order>(objectMapper.readValue("", Order.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<Order>(objectMapper.readValue("", Order.class), HttpStatus.OK);
}
return new ResponseEntity<Order>(HttpStatus.OK);
}
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body,
public ResponseEntity<Order> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order order,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<Order>(objectMapper.readValue("", Order.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<Order>(objectMapper.readValue("", Order.class), HttpStatus.OK);
}
return new ResponseEntity<Order>(HttpStatus.OK);
}

View File

@ -1,5 +1,5 @@
/**
* NOTE: This class is auto generated by the swagger code generator program (2.3.1-SNAPSHOT).
* NOTE: This class is auto generated by the swagger code generator program (3.0.0-SNAPSHOT).
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
@ -34,27 +34,24 @@ public interface UserApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/user",
produces = { "application/xml", "application/json" },
method = RequestMethod.POST)
ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User user, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/user/createWithArray",
produces = { "application/xml", "application/json" },
method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> user, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/user/createWithList",
produces = { "application/xml", "application/json" },
method = RequestMethod.POST)
ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> user, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", })
@ -62,7 +59,6 @@ public interface UserApi {
@ApiResponse(code = 400, message = "Invalid username supplied"),
@ApiResponse(code = 404, message = "User not found") })
@RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" },
method = RequestMethod.DELETE)
ResponseEntity<Void> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ -75,7 +71,7 @@ public interface UserApi {
@RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" },
method = RequestMethod.GET)
ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true ) @PathVariable("username") String username, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", })
@ -92,7 +88,6 @@ public interface UserApi {
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/user/logout",
produces = { "application/xml", "application/json" },
method = RequestMethod.GET)
ResponseEntity<Void> logoutUser( @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
@ -102,8 +97,7 @@ public interface UserApi {
@ApiResponse(code = 400, message = "Invalid user supplied"),
@ApiResponse(code = 404, message = "User not found") })
@RequestMapping(value = "/user/{username}",
produces = { "application/xml", "application/json" },
method = RequestMethod.PUT)
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User user, @RequestHeader(value = "Accept", required = false) String accept) throws Exception;
}

View File

@ -33,19 +33,19 @@ public class UserApiController implements UserApi {
this.objectMapper = objectMapper;
}
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body,
public ResponseEntity<Void> createUser(@ApiParam(value = "Created user object" ,required=true ) @RequestBody User user,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
}
public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body,
public ResponseEntity<Void> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> user,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
}
public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> body,
public ResponseEntity<Void> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @RequestBody List<User> user,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);
@ -57,19 +57,9 @@ public class UserApiController implements UserApi {
return new ResponseEntity<Void>(HttpStatus.OK);
}
public ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username,
public ResponseEntity<User> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true ) @PathVariable("username") String username,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<User>(objectMapper.readValue("", User.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<User>(objectMapper.readValue("", User.class), HttpStatus.OK);
}
return new ResponseEntity<User>(HttpStatus.OK);
}
@ -77,16 +67,6 @@ public class UserApiController implements UserApi {
@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
if (accept != null && accept.contains("application/xml")) {
return new ResponseEntity<String>(objectMapper.readValue("", String.class), HttpStatus.OK);
}
if (accept != null && accept.contains("application/json")) {
return new ResponseEntity<String>(objectMapper.readValue("", String.class), HttpStatus.OK);
}
return new ResponseEntity<String>(HttpStatus.OK);
}
@ -96,7 +76,7 @@ public class UserApiController implements UserApi {
}
public ResponseEntity<Void> updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,
@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body,
@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User user,
@RequestHeader(value = "Accept", required = false) String accept) throws Exception {
// do some magic!
return new ResponseEntity<Void>(HttpStatus.OK);

View File

@ -1,6 +1,6 @@
# Discovery Server Access
server:
port: 8008
port: -1
# Spring Actuator
management:

View File

@ -1,6 +1,6 @@
# Discovery Server Access
server:
port: 8008
port: -1
# Spring Actuator
management:

View File

@ -51,8 +51,8 @@ public class PetApiTest {
*/
@Test
public void addPetTest() throws Exception {
Pet body = null;
ResponseEntity<Void> response = api.addPet(body , accept);
Pet pet = null;
ResponseEntity<Void> response = api.addPet(pet , accept);
// TODO: test validations
}
@ -132,8 +132,8 @@ public class PetApiTest {
*/
@Test
public void updatePetTest() throws Exception {
Pet body = null;
ResponseEntity<Void> response = api.updatePet(body , accept);
Pet pet = null;
ResponseEntity<Void> response = api.updatePet(pet , accept);
// TODO: test validations
}

View File

@ -97,8 +97,8 @@ public class StoreApiTest {
*/
@Test
public void placeOrderTest() throws Exception {
Order body = null;
ResponseEntity<Order> response = api.placeOrder(body , accept);
Order order = null;
ResponseEntity<Order> response = api.placeOrder(order , accept);
// TODO: test validations
}

View File

@ -50,8 +50,8 @@ public class UserApiTest {
*/
@Test
public void createUserTest() throws Exception {
User body = null;
ResponseEntity<Void> response = api.createUser(body , accept);
User user = null;
ResponseEntity<Void> response = api.createUser(user , accept);
// TODO: test validations
}
@ -66,8 +66,8 @@ public class UserApiTest {
*/
@Test
public void createUsersWithArrayInputTest() throws Exception {
List<User> body = null;
ResponseEntity<Void> response = api.createUsersWithArrayInput(body , accept);
List<User> user = null;
ResponseEntity<Void> response = api.createUsersWithArrayInput(user , accept);
// TODO: test validations
}
@ -82,8 +82,8 @@ public class UserApiTest {
*/
@Test
public void createUsersWithListInputTest() throws Exception {
List<User> body = null;
ResponseEntity<Void> response = api.createUsersWithListInput(body , accept);
List<User> user = null;
ResponseEntity<Void> response = api.createUsersWithListInput(user , accept);
// TODO: test validations
}
@ -163,8 +163,8 @@ public class UserApiTest {
@Test
public void updateUserTest() throws Exception {
String username = null;
User body = null;
ResponseEntity<Void> response = api.updateUser(username, body , accept);
User user = null;
ResponseEntity<Void> response = api.updateUser(username, user , accept);
// TODO: test validations
}