forked from loafle/openapi-generator-original
* Fix issue #6100. Tested with all the samples. * Fix multiple issue with the examples. Removing all of this. Adding fake endpoint .sh but it is not compiling right now.
This commit is contained in:
committed by
wing328
parent
5c384d0f15
commit
1e991be5f3
@@ -0,0 +1,13 @@
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
import controllers.*;
|
||||
|
||||
public class Module extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(PetApiControllerImpInterface.class).to(PetApiControllerImp.class);
|
||||
bind(StoreApiControllerImpInterface.class).to(StoreApiControllerImp.class);
|
||||
bind(UserApiControllerImpInterface.class).to(UserApiControllerImp.class);
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ public class Order {
|
||||
* Get complete
|
||||
* @return complete
|
||||
**/
|
||||
public Boolean getComplete() {
|
||||
public Boolean isComplete() {
|
||||
return complete;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ import swagger.SwaggerUtils.ApiAction;
|
||||
|
||||
public class PetApiController extends Controller {
|
||||
|
||||
private final PetApiControllerImp imp;
|
||||
private final PetApiControllerImpInterface imp;
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private PetApiController(PetApiControllerImp imp) {
|
||||
private PetApiController(PetApiControllerImpInterface imp) {
|
||||
this.imp = imp;
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@@ -11,14 +11,6 @@ import java.util.HashMap;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private PetApiControllerImp() {
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPet(Pet body) throws Exception {
|
||||
//Do your magic!!!
|
||||
@@ -34,42 +26,18 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public List<Pet> findPetsByStatus(List<String> status) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", List.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", List.class);
|
||||
}
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pet> findPetsByTags(List<String> tags) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", List.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", List.class);
|
||||
}
|
||||
return new ArrayList<Pet>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pet getPetById(Long petId) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", Pet.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", Pet.class);
|
||||
}
|
||||
return new Pet();
|
||||
}
|
||||
|
||||
@@ -88,10 +56,6 @@ public class PetApiControllerImp implements PetApiControllerImpInterface {
|
||||
@Override
|
||||
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", ModelApiResponse.class);
|
||||
}
|
||||
return new ModelApiResponse();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ import swagger.SwaggerUtils.ApiAction;
|
||||
|
||||
public class StoreApiController extends Controller {
|
||||
|
||||
private final StoreApiControllerImp imp;
|
||||
private final StoreApiControllerImpInterface imp;
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private StoreApiController(StoreApiControllerImp imp) {
|
||||
private StoreApiController(StoreApiControllerImpInterface imp) {
|
||||
this.imp = imp;
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@@ -10,14 +10,6 @@ import java.util.HashMap;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private StoreApiControllerImp() {
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOrder(String orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
@@ -27,38 +19,18 @@ public class StoreApiControllerImp implements StoreApiControllerImpInterface {
|
||||
@Override
|
||||
public Map<String, Integer> getInventory() throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", Map.class);
|
||||
}
|
||||
return new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrderById(Long orderId) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", Order.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", Order.class);
|
||||
}
|
||||
return new Order();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order placeOrder(Order body) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", Order.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", Order.class);
|
||||
}
|
||||
return new Order();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,11 @@ import swagger.SwaggerUtils.ApiAction;
|
||||
|
||||
public class UserApiController extends Controller {
|
||||
|
||||
private final UserApiControllerImp imp;
|
||||
private final UserApiControllerImpInterface imp;
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private UserApiController(UserApiControllerImp imp) {
|
||||
private UserApiController(UserApiControllerImpInterface imp) {
|
||||
this.imp = imp;
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@@ -10,14 +10,6 @@ import java.util.HashMap;
|
||||
import java.io.FileInputStream;
|
||||
|
||||
public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
|
||||
private final ObjectMapper mapper;
|
||||
|
||||
@Inject
|
||||
private UserApiControllerImp() {
|
||||
mapper = new ObjectMapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createUser(User body) throws Exception {
|
||||
//Do your magic!!!
|
||||
@@ -45,28 +37,12 @@ public class UserApiControllerImp implements UserApiControllerImpInterface {
|
||||
@Override
|
||||
public User getUserByName(String username) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", User.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", User.class);
|
||||
}
|
||||
return new User();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String loginUser(String username, String password) throws Exception {
|
||||
//Do your magic!!!
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/xml")) {
|
||||
return mapper.readValue("", String.class);
|
||||
}
|
||||
String accept = request().getHeader("Accept");
|
||||
if (accept != null && accept.contains("application/json")) {
|
||||
return mapper.readValue("", String.class);
|
||||
}
|
||||
return new String();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,4 @@ lazy val root = (project in file(".")).enablePlugins(PlayJava)
|
||||
|
||||
scalaVersion := "2.11.7"
|
||||
|
||||
libraryDependencies ++= Seq(
|
||||
javaJdbc,
|
||||
cache,
|
||||
javaWs,
|
||||
"org.webjars" % "swagger-ui" % "2.2.10-1")
|
||||
libraryDependencies += "org.webjars" % "swagger-ui" % "2.2.10-1"
|
||||
|
||||
@@ -59,7 +59,6 @@ play.modules {
|
||||
# in the root package (the "app" directory), or you can define them
|
||||
# explicitly below.
|
||||
# If there are any built-in modules that you want to disable, you can list them here.
|
||||
#disabled += ""
|
||||
}
|
||||
|
||||
## IDE
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
2017-08-08 12:59:36,779 [INFO] from play.api.Play in ForkJoinPool-1-worker-1 - Application started (Dev)
|
||||
@@ -173,6 +173,7 @@
|
||||
"security" : [ {
|
||||
"petstore_auth" : [ "write:pets", "read:pets" ]
|
||||
} ],
|
||||
"deprecated" : true,
|
||||
"x-contentType" : "application/json",
|
||||
"x-accepts" : "application/json"
|
||||
}
|
||||
@@ -749,7 +750,7 @@
|
||||
"title" : "Pet catehgry",
|
||||
"description" : "A category for a pet",
|
||||
"example" : {
|
||||
"name" : "aeiou",
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"xml" : {
|
||||
@@ -790,14 +791,14 @@
|
||||
"title" : "a User",
|
||||
"description" : "A User who is purchasing from the pet store",
|
||||
"example" : {
|
||||
"firstName" : "aeiou",
|
||||
"lastName" : "aeiou",
|
||||
"password" : "aeiou",
|
||||
"firstName" : "firstName",
|
||||
"lastName" : "lastName",
|
||||
"password" : "password",
|
||||
"userStatus" : 6,
|
||||
"phone" : "aeiou",
|
||||
"phone" : "phone",
|
||||
"id" : 0,
|
||||
"email" : "aeiou",
|
||||
"username" : "aeiou"
|
||||
"email" : "email",
|
||||
"username" : "username"
|
||||
},
|
||||
"xml" : {
|
||||
"name" : "User"
|
||||
@@ -817,7 +818,7 @@
|
||||
"title" : "Pet Tag",
|
||||
"description" : "A tag for a pet",
|
||||
"example" : {
|
||||
"name" : "aeiou",
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
},
|
||||
"xml" : {
|
||||
@@ -868,15 +869,18 @@
|
||||
"title" : "a Pet",
|
||||
"description" : "A pet for sale in the pet store",
|
||||
"example" : {
|
||||
"photoUrls" : [ "aeiou" ],
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "aeiou",
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "aeiou",
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
@@ -903,8 +907,8 @@
|
||||
"description" : "Describes the result of uploading an image resource",
|
||||
"example" : {
|
||||
"code" : 0,
|
||||
"type" : "aeiou",
|
||||
"message" : "aeiou"
|
||||
"type" : "type",
|
||||
"message" : "message"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user