Skip to content

Commit 40a2f45

Browse files
committed
fix: maintain prev whitespaces & update generated APIs
1 parent 1b22b41 commit 40a2f45

11 files changed

Lines changed: 50 additions & 50 deletions

File tree

modules/openapi-generator/src/main/resources/scala-sttp/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class {{classname}}(baseUrl: String) {
2222
{{/javadocRenderer}}
2323
def {{operationId}}({{>methodParameters}}): Request[{{#separateErrorChannel}}Either[ResponseException[String, Exception], {{>operationReturnType}}]{{/separateErrorChannel}}{{^separateErrorChannel}}{{>operationReturnType}}{{/separateErrorChannel}}, Any] =
2424
basicRequest
25-
.method(Method.{{httpMethod.toUpperCase}}, uri"$baseUrl{{{path}}}{{#queryParams.0}}?{{/queryParams.0}}{{#queryParams}}{{baseName}}=${{{paramName}}}{{^-last}}&{{/-last}}{{/queryParams}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}}{{#queryParams.0}}&{{/queryParams.0}}{{^queryParams.0}}?{{/queryParams.0}}{{keyParamName}}=${apiKeyQuery}{{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}}")
25+
.method(Method.{{httpMethod.toUpperCase}}, uri"$baseUrl{{{path}}}{{#queryParams.0}}?{{/queryParams.0}}{{#queryParams}}{{baseName}}=${ {{paramName}} }{{^-last}}&{{/-last}}{{/queryParams}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}}{{#queryParams.0}}&{{/queryParams.0}}{{^queryParams.0}}?{{/queryParams.0}}{{keyParamName}}=${apiKeyQuery}{{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}}")
2626
.contentType({{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}}){{#headerParams}}
2727
.header({{>paramCreation}}){{/headerParams}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
2828
.auth.basic(username, password){{/isBasicBasic}}{{#isBasicBearer}}

modules/openapi-generator/src/main/resources/scala-sttp4/api.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class {{classname}}(baseUrl: String) {
2222
{{/javadocRenderer}}
2323
def {{operationId}}({{>methodParameters}}): Request[{{#separateErrorChannel}}Either[ResponseException[String, Exception], {{>operationReturnType}}]{{/separateErrorChannel}}{{^separateErrorChannel}}{{>operationReturnType}}{{/separateErrorChannel}}] =
2424
basicRequest
25-
.method(Method.{{httpMethod.toUpperCase}}, uri"$baseUrl{{{path}}}{{#queryParams.0}}?{{/queryParams.0}}{{#queryParams}}{{baseName}}=${{{paramName}}}{{^-last}}&{{/-last}}{{/queryParams}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}}{{#queryParams.0}}&{{/queryParams.0}}{{^queryParams.0}}?{{/queryParams.0}}{{keyParamName}}=${apiKeyQuery}{{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}}")
25+
.method(Method.{{httpMethod.toUpperCase}}, uri"$baseUrl{{{path}}}{{#queryParams.0}}?{{/queryParams.0}}{{#queryParams}}{{baseName}}=${ {{paramName}} }{{^-last}}&{{/-last}}{{/queryParams}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}}{{#queryParams.0}}&{{/queryParams.0}}{{^queryParams.0}}?{{/queryParams.0}}{{keyParamName}}=${apiKeyQuery}{{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}}")
2626
.contentType({{#consumes.0}}"{{{mediaType}}}"{{/consumes.0}}{{^consumes}}"application/json"{{/consumes}}){{#headerParams}}
2727
.header({{>paramCreation}}){{/headerParams}}{{#authMethods}}{{#isBasic}}{{#isBasicBasic}}
2828
.auth.basic(username, password){{/isBasicBasic}}{{#isBasicBearer}}

samples/client/petstore/scala-sttp-circe/src/main/scala/org/openapitools/client/api/PetApi.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ class PetApi(baseUrl: String) {
103103
*
104104
* @param petId ID of pet to return
105105
*/
106-
def getPetById(apiKey: String)(petId: Long
106+
def getPetById(apiKeyHeader: String)(petId: Long
107107
): Request[Either[ResponseException[String, Exception], Pet], Any] =
108108
basicRequest
109109
.method(Method.GET, uri"$baseUrl/pet/${petId}")
110110
.contentType("application/json")
111-
.header("api_key", apiKey)
111+
.header("api_key", apiKeyHeader)
112112
.response(asJson[Pet])
113113

114114
/**

samples/client/petstore/scala-sttp-circe/src/main/scala/org/openapitools/client/api/StoreApi.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ class StoreApi(baseUrl: String) {
4747
* Available security schemes:
4848
* api_key (apiKey)
4949
*/
50-
def getInventory(apiKey: String)(
50+
def getInventory(apiKeyHeader: String)(
5151
): Request[Either[ResponseException[String, Exception], Map[String, Int]], Any] =
5252
basicRequest
5353
.method(Method.GET, uri"$baseUrl/store/inventory")
5454
.contentType("application/json")
55-
.header("api_key", apiKey)
55+
.header("api_key", apiKeyHeader)
5656
.response(asJson[Map[String, Int]])
5757

5858
/**

samples/client/petstore/scala-sttp-circe/src/main/scala/org/openapitools/client/api/UserApi.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ class UserApi(baseUrl: String) {
3434
*
3535
* @param user Created user object
3636
*/
37-
def createUser(apiKey: String)(user: User
37+
def createUser(apiKeyHeader: String)(user: User
3838
): Request[Either[ResponseException[String, Exception], Unit], Any] =
3939
basicRequest
4040
.method(Method.POST, uri"$baseUrl/user")
4141
.contentType("application/json")
42-
.header("api_key", apiKey)
42+
.header("api_key", apiKeyHeader)
4343
.body(user)
4444
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
4545

@@ -54,12 +54,12 @@ class UserApi(baseUrl: String) {
5454
*
5555
* @param user List of user object
5656
*/
57-
def createUsersWithArrayInput(apiKey: String)(user: Seq[User]
57+
def createUsersWithArrayInput(apiKeyHeader: String)(user: Seq[User]
5858
): Request[Either[ResponseException[String, Exception], Unit], Any] =
5959
basicRequest
6060
.method(Method.POST, uri"$baseUrl/user/createWithArray")
6161
.contentType("application/json")
62-
.header("api_key", apiKey)
62+
.header("api_key", apiKeyHeader)
6363
.body(user)
6464
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
6565

@@ -74,12 +74,12 @@ class UserApi(baseUrl: String) {
7474
*
7575
* @param user List of user object
7676
*/
77-
def createUsersWithListInput(apiKey: String)(user: Seq[User]
77+
def createUsersWithListInput(apiKeyHeader: String)(user: Seq[User]
7878
): Request[Either[ResponseException[String, Exception], Unit], Any] =
7979
basicRequest
8080
.method(Method.POST, uri"$baseUrl/user/createWithList")
8181
.contentType("application/json")
82-
.header("api_key", apiKey)
82+
.header("api_key", apiKeyHeader)
8383
.body(user)
8484
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
8585

@@ -95,12 +95,12 @@ class UserApi(baseUrl: String) {
9595
*
9696
* @param username The name that needs to be deleted
9797
*/
98-
def deleteUser(apiKey: String)(username: String
98+
def deleteUser(apiKeyHeader: String)(username: String
9999
): Request[Either[ResponseException[String, Exception], Unit], Any] =
100100
basicRequest
101101
.method(Method.DELETE, uri"$baseUrl/user/${username}")
102102
.contentType("application/json")
103-
.header("api_key", apiKey)
103+
.header("api_key", apiKeyHeader)
104104
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
105105

106106
/**
@@ -150,12 +150,12 @@ class UserApi(baseUrl: String) {
150150
* Available security schemes:
151151
* api_key (apiKey)
152152
*/
153-
def logoutUser(apiKey: String)(
153+
def logoutUser(apiKeyHeader: String)(
154154
): Request[Either[ResponseException[String, Exception], Unit], Any] =
155155
basicRequest
156156
.method(Method.GET, uri"$baseUrl/user/logout")
157157
.contentType("application/json")
158-
.header("api_key", apiKey)
158+
.header("api_key", apiKeyHeader)
159159
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
160160

161161
/**
@@ -171,12 +171,12 @@ class UserApi(baseUrl: String) {
171171
* @param username name that need to be deleted
172172
* @param user Updated user object
173173
*/
174-
def updateUser(apiKey: String)(username: String, user: User
174+
def updateUser(apiKeyHeader: String)(username: String, user: User
175175
): Request[Either[ResponseException[String, Exception], Unit], Any] =
176176
basicRequest
177177
.method(Method.PUT, uri"$baseUrl/user/${username}")
178178
.contentType("application/json")
179-
.header("api_key", apiKey)
179+
.header("api_key", apiKeyHeader)
180180
.body(user)
181181
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
182182

samples/client/petstore/scala-sttp/src/main/scala/org/openapitools/client/api/PetApi.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ class PetApi(baseUrl: String) {
103103
*
104104
* @param petId ID of pet to return
105105
*/
106-
def getPetById(apiKey: String)(petId: Long
106+
def getPetById(apiKeyHeader: String)(petId: Long
107107
): Request[Either[ResponseException[String, Exception], Pet], Any] =
108108
basicRequest
109109
.method(Method.GET, uri"$baseUrl/pet/${petId}")
110110
.contentType("application/json")
111-
.header("api_key", apiKey)
111+
.header("api_key", apiKeyHeader)
112112
.response(asJson[Pet])
113113

114114
/**

samples/client/petstore/scala-sttp/src/main/scala/org/openapitools/client/api/StoreApi.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ class StoreApi(baseUrl: String) {
4747
* Available security schemes:
4848
* api_key (apiKey)
4949
*/
50-
def getInventory(apiKey: String)(
50+
def getInventory(apiKeyHeader: String)(
5151
): Request[Either[ResponseException[String, Exception], Map[String, Int]], Any] =
5252
basicRequest
5353
.method(Method.GET, uri"$baseUrl/store/inventory")
5454
.contentType("application/json")
55-
.header("api_key", apiKey)
55+
.header("api_key", apiKeyHeader)
5656
.response(asJson[Map[String, Int]])
5757

5858
/**

samples/client/petstore/scala-sttp/src/main/scala/org/openapitools/client/api/UserApi.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ class UserApi(baseUrl: String) {
3434
*
3535
* @param user Created user object
3636
*/
37-
def createUser(apiKey: String)(user: User
37+
def createUser(apiKeyHeader: String)(user: User
3838
): Request[Either[ResponseException[String, Exception], Unit], Any] =
3939
basicRequest
4040
.method(Method.POST, uri"$baseUrl/user")
4141
.contentType("application/json")
42-
.header("api_key", apiKey)
42+
.header("api_key", apiKeyHeader)
4343
.body(user)
4444
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
4545

@@ -54,12 +54,12 @@ class UserApi(baseUrl: String) {
5454
*
5555
* @param user List of user object
5656
*/
57-
def createUsersWithArrayInput(apiKey: String)(user: Seq[User]
57+
def createUsersWithArrayInput(apiKeyHeader: String)(user: Seq[User]
5858
): Request[Either[ResponseException[String, Exception], Unit], Any] =
5959
basicRequest
6060
.method(Method.POST, uri"$baseUrl/user/createWithArray")
6161
.contentType("application/json")
62-
.header("api_key", apiKey)
62+
.header("api_key", apiKeyHeader)
6363
.body(user)
6464
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
6565

@@ -74,12 +74,12 @@ class UserApi(baseUrl: String) {
7474
*
7575
* @param user List of user object
7676
*/
77-
def createUsersWithListInput(apiKey: String)(user: Seq[User]
77+
def createUsersWithListInput(apiKeyHeader: String)(user: Seq[User]
7878
): Request[Either[ResponseException[String, Exception], Unit], Any] =
7979
basicRequest
8080
.method(Method.POST, uri"$baseUrl/user/createWithList")
8181
.contentType("application/json")
82-
.header("api_key", apiKey)
82+
.header("api_key", apiKeyHeader)
8383
.body(user)
8484
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
8585

@@ -95,12 +95,12 @@ class UserApi(baseUrl: String) {
9595
*
9696
* @param username The name that needs to be deleted
9797
*/
98-
def deleteUser(apiKey: String)(username: String
98+
def deleteUser(apiKeyHeader: String)(username: String
9999
): Request[Either[ResponseException[String, Exception], Unit], Any] =
100100
basicRequest
101101
.method(Method.DELETE, uri"$baseUrl/user/${username}")
102102
.contentType("application/json")
103-
.header("api_key", apiKey)
103+
.header("api_key", apiKeyHeader)
104104
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
105105

106106
/**
@@ -150,12 +150,12 @@ class UserApi(baseUrl: String) {
150150
* Available security schemes:
151151
* api_key (apiKey)
152152
*/
153-
def logoutUser(apiKey: String)(
153+
def logoutUser(apiKeyHeader: String)(
154154
): Request[Either[ResponseException[String, Exception], Unit], Any] =
155155
basicRequest
156156
.method(Method.GET, uri"$baseUrl/user/logout")
157157
.contentType("application/json")
158-
.header("api_key", apiKey)
158+
.header("api_key", apiKeyHeader)
159159
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
160160

161161
/**
@@ -171,12 +171,12 @@ class UserApi(baseUrl: String) {
171171
* @param username name that need to be deleted
172172
* @param user Updated user object
173173
*/
174-
def updateUser(apiKey: String)(username: String, user: User
174+
def updateUser(apiKeyHeader: String)(username: String, user: User
175175
): Request[Either[ResponseException[String, Exception], Unit], Any] =
176176
basicRequest
177177
.method(Method.PUT, uri"$baseUrl/user/${username}")
178178
.contentType("application/json")
179-
.header("api_key", apiKey)
179+
.header("api_key", apiKeyHeader)
180180
.body(user)
181181
.response(asString.mapWithMetadata(ResponseAs.deserializeRightWithError(_ => Right(()))))
182182

samples/client/petstore/scala-sttp4/src/main/scala/org/openapitools/client/api/PetApi.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ class PetApi(baseUrl: String) {
9999
*
100100
* @param petId ID of pet to return
101101
*/
102-
def getPetById(apiKey: String)(petId: Long): Request[Either[ResponseException[String, Exception], Pet]] =
102+
def getPetById(apiKeyHeader: String)(petId: Long): Request[Either[ResponseException[String, Exception], Pet]] =
103103
basicRequest
104104
.method(Method.GET, uri"$baseUrl/pet/${petId}")
105105
.contentType("application/json")
106-
.header("api_key", apiKey)
106+
.header("api_key", apiKeyHeader)
107107
.response(asJson[Pet])
108108

109109
/**

samples/client/petstore/scala-sttp4/src/main/scala/org/openapitools/client/api/StoreApi.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ class StoreApi(baseUrl: String) {
4646
* Available security schemes:
4747
* api_key (apiKey)
4848
*/
49-
def getInventory(apiKey: String)(): Request[Either[ResponseException[String, Exception], Map[String, Int]]] =
49+
def getInventory(apiKeyHeader: String)(): Request[Either[ResponseException[String, Exception], Map[String, Int]]] =
5050
basicRequest
5151
.method(Method.GET, uri"$baseUrl/store/inventory")
5252
.contentType("application/json")
53-
.header("api_key", apiKey)
53+
.header("api_key", apiKeyHeader)
5454
.response(asJson[Map[String, Int]])
5555

5656
/**

0 commit comments

Comments
 (0)