forked from loafle/openapi-generator-original
fix scala akka return type (#2510)
This commit is contained in:
parent
5a6f4cb4a9
commit
d4244be654
@ -49,13 +49,7 @@ public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements Code
|
||||
protected boolean registerNonStandardStatusCodes = true;
|
||||
protected boolean renderJavadoc = true;
|
||||
protected boolean removeOAuthSecurities = true;
|
||||
/**
|
||||
* If set to true, only the default response (the one with le lowest 2XX code) will be considered as a success, and all
|
||||
* others as ApiErrors.
|
||||
* If set to false, all responses defined in the model will be considered as a success upon reception. Only http errors,
|
||||
* unmarshalling problems and any other RuntimeException will be considered as ApiErrors.
|
||||
*/
|
||||
protected boolean onlyOneSuccess = true;
|
||||
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
protected Logger LOGGER = LoggerFactory.getLogger(ScalaAkkaClientCodegen.class);
|
||||
@ -92,7 +86,6 @@ public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements Code
|
||||
additionalProperties.put("fnCapitalize", new CapitalizeLambda());
|
||||
additionalProperties.put("fnCamelize", new CamelizeLambda(false));
|
||||
additionalProperties.put("fnEnumEntry", new EnumEntryLambda());
|
||||
additionalProperties.put("onlyOneSuccess", onlyOneSuccess);
|
||||
additionalProperties.put("mainPackage", mainPackage);
|
||||
|
||||
importMapping.remove("Seq");
|
||||
|
@ -1 +1 @@
|
||||
{{#onlyOneSuccess}}{{^defaultResponse}}Unit{{/defaultResponse}}{{#defaultResponse}}{{#responses}}{{#isDefault}}{{#dataType}}{{dataType}}{{/dataType}}{{^dataType}}Unit{{/dataType}}{{/isDefault}}{{/responses}}{{/defaultResponse}}{{/onlyOneSuccess}}{{^onlyOneSuccess}}{{#responses}}{{#-first}}{{^hasMore}}{{#dataType}}{{dataType}}{{/dataType}}{{^dataType}}Unit{{/dataType}}{{/hasMore}}{{#hasMore}}Any{{/hasMore}}{{/-first}}{{/responses}}{{/onlyOneSuccess}}
|
||||
{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Unit{{/returnType}}
|
@ -1 +1 @@
|
||||
{{#onlyOneSuccess}}{{#isDefault}}Success{{/isDefault}}{{^isDefault}}Error{{/isDefault}}{{/onlyOneSuccess}}{{^onlyOneSuccess}}Success{{/onlyOneSuccess}}
|
||||
{{#isDefault}}Success{{/isDefault}}{{^isDefault}}Error{{/isDefault}}
|
@ -96,8 +96,8 @@ class PetApi(baseUrl: String) {
|
||||
*
|
||||
* @param petId ID of pet to return
|
||||
*/
|
||||
def getPetById(petId: Long)(implicit apiKey: ApiKeyValue): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/json")
|
||||
def getPetById(petId: Long)(implicit apiKey: ApiKeyValue): ApiRequest[Pet] =
|
||||
ApiRequest[Pet](ApiMethods.GET, "http://petstore.swagger.io/v2", "/pet/{petId}", "application/json")
|
||||
.withApiKey(apiKey, "api_key", HEADER)
|
||||
.withPathParam("petId", petId)
|
||||
.withSuccessResponse[Pet](200)
|
||||
@ -145,8 +145,8 @@ class PetApi(baseUrl: String) {
|
||||
* @param additionalMetadata Additional data to pass to server
|
||||
* @param file file to upload
|
||||
*/
|
||||
def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet/{petId}/uploadImage", "multipart/form-data")
|
||||
def uploadFile(petId: Long, additionalMetadata: Option[String] = None, file: Option[File] = None): ApiRequest[ApiResponse] =
|
||||
ApiRequest[ApiResponse](ApiMethods.POST, "http://petstore.swagger.io/v2", "/pet/{petId}/uploadImage", "multipart/form-data")
|
||||
.withFormParam("additionalMetadata", additionalMetadata)
|
||||
.withFormParam("file", file)
|
||||
.withPathParam("petId", petId)
|
||||
|
@ -64,8 +64,8 @@ class StoreApi(baseUrl: String) {
|
||||
*
|
||||
* @param orderId ID of pet that needs to be fetched
|
||||
*/
|
||||
def getOrderById(orderId: Long): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/store/order/{orderId}", "application/json")
|
||||
def getOrderById(orderId: Long): ApiRequest[Order] =
|
||||
ApiRequest[Order](ApiMethods.GET, "http://petstore.swagger.io/v2", "/store/order/{orderId}", "application/json")
|
||||
.withPathParam("orderId", orderId)
|
||||
.withSuccessResponse[Order](200)
|
||||
.withErrorResponse[Unit](400)
|
||||
@ -79,8 +79,8 @@ class StoreApi(baseUrl: String) {
|
||||
*
|
||||
* @param body order placed for purchasing the pet
|
||||
*/
|
||||
def placeOrder(body: Order): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.POST, "http://petstore.swagger.io/v2", "/store/order", "application/json")
|
||||
def placeOrder(body: Order): ApiRequest[Order] =
|
||||
ApiRequest[Order](ApiMethods.POST, "http://petstore.swagger.io/v2", "/store/order", "application/json")
|
||||
.withBody(body)
|
||||
.withSuccessResponse[Order](200)
|
||||
.withErrorResponse[Unit](400)
|
||||
|
@ -85,8 +85,8 @@ class UserApi(baseUrl: String) {
|
||||
*
|
||||
* @param username The name that needs to be fetched. Use user1 for testing.
|
||||
*/
|
||||
def getUserByName(username: String): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
|
||||
def getUserByName(username: String): ApiRequest[User] =
|
||||
ApiRequest[User](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/{username}", "application/json")
|
||||
.withPathParam("username", username)
|
||||
.withSuccessResponse[User](200)
|
||||
.withErrorResponse[Unit](400)
|
||||
@ -104,8 +104,8 @@ class UserApi(baseUrl: String) {
|
||||
* @param username The user name for login
|
||||
* @param password The password for login in clear text
|
||||
*/
|
||||
def loginUser(username: String, password: String): ApiRequest[Unit] =
|
||||
ApiRequest[Unit](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/login", "application/json")
|
||||
def loginUser(username: String, password: String): ApiRequest[String] =
|
||||
ApiRequest[String](ApiMethods.GET, "http://petstore.swagger.io/v2", "/user/login", "application/json")
|
||||
.withQueryParam("username", username)
|
||||
.withQueryParam("password", password)
|
||||
.withSuccessResponse[String](200)
|
||||
|
Loading…
x
Reference in New Issue
Block a user