Skip to content

Commit 81ce76f

Browse files
committed
feat: Added HTTP method+path to JavaDocs in kotlin Ktor client
1 parent f34db81 commit 81ce76f

File tree

10 files changed

+61
-0
lines changed

10 files changed

+61
-0
lines changed

modules/openapi-generator/src/main/resources/kotlin-client/libraries/jvm-ktor/api.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
4343
4444
{{#operation}}
4545
/**
46+
* {{{httpMethod}}} {{{path}}}
4647
* {{summary}}
4748
* {{notes}}
4849
{{#allParams}} * @param {{{paramName}}} {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}

samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import java.text.DateFormat
4040
) {
4141

4242
/**
43+
* POST /pet
4344
* Add a new pet to the store
4445
*
4546
* @param body Pet object that needs to be added to the store
@@ -71,6 +72,7 @@ import java.text.DateFormat
7172
}
7273

7374
/**
75+
* DELETE /pet/{petId}
7476
* Deletes a pet
7577
*
7678
* @param petId Pet id to delete
@@ -105,6 +107,7 @@ import java.text.DateFormat
105107
}
106108

107109
/**
110+
* GET /pet/findByStatus
108111
* Finds Pets by status
109112
* Multiple status values can be provided with comma separated strings
110113
* @param status Status values that need to be considered for filter
@@ -139,6 +142,7 @@ import java.text.DateFormat
139142
}
140143

141144
/**
145+
* GET /pet/findByTags
142146
* Finds Pets by tags
143147
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
144148
* @param tags Tags to filter by
@@ -173,6 +177,7 @@ import java.text.DateFormat
173177
}
174178

175179
/**
180+
* GET /pet/{petId}
176181
* Find pet by ID
177182
* Returns a single pet
178183
* @param petId ID of pet to return
@@ -206,6 +211,7 @@ import java.text.DateFormat
206211
}
207212

208213
/**
214+
* PUT /pet
209215
* Update an existing pet
210216
*
211217
* @param body Pet object that needs to be added to the store
@@ -237,6 +243,7 @@ import java.text.DateFormat
237243
}
238244

239245
/**
246+
* POST /pet/{petId}
240247
* Updates a pet in the store with form data
241248
*
242249
* @param petId ID of pet that needs to be updated
@@ -274,6 +281,7 @@ import java.text.DateFormat
274281
}
275282

276283
/**
284+
* POST /pet/{petId}/uploadImage
277285
* uploads an image
278286
*
279287
* @param petId ID of pet to update

samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import java.text.DateFormat
3939
) {
4040

4141
/**
42+
* DELETE /store/order/{orderId}
4243
* Delete purchase order by ID
4344
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
4445
* @param orderId ID of the order that needs to be deleted
@@ -71,6 +72,7 @@ import java.text.DateFormat
7172
}
7273

7374
/**
75+
* GET /store/inventory
7476
* Returns pet inventories by status
7577
* Returns a map of status codes to quantities
7678
* @return kotlin.collections.Map<kotlin.String, kotlin.Int>
@@ -103,6 +105,7 @@ import java.text.DateFormat
103105
}
104106

105107
/**
108+
* GET /store/order/{orderId}
106109
* Find purchase order by ID
107110
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
108111
* @param orderId ID of pet that needs to be fetched
@@ -136,6 +139,7 @@ import java.text.DateFormat
136139
}
137140

138141
/**
142+
* POST /store/order
139143
* Place an order for a pet
140144
*
141145
* @param body order placed for purchasing the pet

samples/client/petstore/kotlin-jvm-ktor-gson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import java.text.DateFormat
3939
) {
4040

4141
/**
42+
* POST /user
4243
* Create user
4344
* This can only be done by the logged in user.
4445
* @param body Created user object
@@ -70,6 +71,7 @@ import java.text.DateFormat
7071
}
7172

7273
/**
74+
* POST /user/createWithArray
7375
* Creates list of users with given input array
7476
*
7577
* @param body List of user object
@@ -101,6 +103,7 @@ import java.text.DateFormat
101103
}
102104

103105
/**
106+
* POST /user/createWithList
104107
* Creates list of users with given input array
105108
*
106109
* @param body List of user object
@@ -132,6 +135,7 @@ import java.text.DateFormat
132135
}
133136

134137
/**
138+
* DELETE /user/{username}
135139
* Delete user
136140
* This can only be done by the logged in user.
137141
* @param username The name that needs to be deleted
@@ -164,6 +168,7 @@ import java.text.DateFormat
164168
}
165169

166170
/**
171+
* GET /user/{username}
167172
* Get user by user name
168173
*
169174
* @param username The name that needs to be fetched. Use user1 for testing.
@@ -197,6 +202,7 @@ import java.text.DateFormat
197202
}
198203

199204
/**
205+
* GET /user/login
200206
* Logs user into the system
201207
*
202208
* @param username The user name for login
@@ -233,6 +239,7 @@ import java.text.DateFormat
233239
}
234240

235241
/**
242+
* GET /user/logout
236243
* Logs out current logged in user session
237244
*
238245
* @return void
@@ -264,6 +271,7 @@ import java.text.DateFormat
264271
}
265272

266273
/**
274+
* PUT /user/{username}
267275
* Updated user
268276
* This can only be done by the logged in user.
269277
* @param username name that need to be deleted

samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/PetApi.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
3838
) {
3939

4040
/**
41+
* POST /pet
4142
* Add a new pet to the store
4243
*
4344
* @param body Pet object that needs to be added to the store
@@ -69,6 +70,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
6970
}
7071

7172
/**
73+
* DELETE /pet/{petId}
7274
* Deletes a pet
7375
*
7476
* @param petId Pet id to delete
@@ -103,6 +105,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
103105
}
104106

105107
/**
108+
* GET /pet/findByStatus
106109
* Finds Pets by status
107110
* Multiple status values can be provided with comma separated strings
108111
* @param status Status values that need to be considered for filter
@@ -137,6 +140,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
137140
}
138141

139142
/**
143+
* GET /pet/findByTags
140144
* Finds Pets by tags
141145
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
142146
* @param tags Tags to filter by
@@ -171,6 +175,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
171175
}
172176

173177
/**
178+
* GET /pet/{petId}
174179
* Find pet by ID
175180
* Returns a single pet
176181
* @param petId ID of pet to return
@@ -204,6 +209,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
204209
}
205210

206211
/**
212+
* PUT /pet
207213
* Update an existing pet
208214
*
209215
* @param body Pet object that needs to be added to the store
@@ -235,6 +241,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
235241
}
236242

237243
/**
244+
* POST /pet/{petId}
238245
* Updates a pet in the store with form data
239246
*
240247
* @param petId ID of pet that needs to be updated
@@ -272,6 +279,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
272279
}
273280

274281
/**
282+
* POST /pet/{petId}/uploadImage
275283
* uploads an image
276284
*
277285
* @param petId ID of pet to update

samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/StoreApi.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
3737
) {
3838

3939
/**
40+
* DELETE /store/order/{orderId}
4041
* Delete purchase order by ID
4142
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
4243
* @param orderId ID of the order that needs to be deleted
@@ -69,6 +70,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
6970
}
7071

7172
/**
73+
* GET /store/inventory
7274
* Returns pet inventories by status
7375
* Returns a map of status codes to quantities
7476
* @return kotlin.collections.Map<kotlin.String, kotlin.Int>
@@ -101,6 +103,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
101103
}
102104

103105
/**
106+
* GET /store/order/{orderId}
104107
* Find purchase order by ID
105108
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
106109
* @param orderId ID of pet that needs to be fetched
@@ -134,6 +137,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
134137
}
135138

136139
/**
140+
* POST /store/order
137141
* Place an order for a pet
138142
*
139143
* @param body order placed for purchasing the pet

samples/client/petstore/kotlin-jvm-ktor-jackson/src/main/kotlin/org/openapitools/client/apis/UserApi.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
3737
) {
3838

3939
/**
40+
* POST /user
4041
* Create user
4142
* This can only be done by the logged in user.
4243
* @param body Created user object
@@ -68,6 +69,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
6869
}
6970

7071
/**
72+
* POST /user/createWithArray
7173
* Creates list of users with given input array
7274
*
7375
* @param body List of user object
@@ -99,6 +101,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
99101
}
100102

101103
/**
104+
* POST /user/createWithList
102105
* Creates list of users with given input array
103106
*
104107
* @param body List of user object
@@ -130,6 +133,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
130133
}
131134

132135
/**
136+
* DELETE /user/{username}
133137
* Delete user
134138
* This can only be done by the logged in user.
135139
* @param username The name that needs to be deleted
@@ -162,6 +166,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
162166
}
163167

164168
/**
169+
* GET /user/{username}
165170
* Get user by user name
166171
*
167172
* @param username The name that needs to be fetched. Use user1 for testing.
@@ -195,6 +200,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
195200
}
196201

197202
/**
203+
* GET /user/login
198204
* Logs user into the system
199205
*
200206
* @param username The user name for login
@@ -231,6 +237,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
231237
}
232238

233239
/**
240+
* GET /user/logout
234241
* Logs out current logged in user session
235242
*
236243
* @return void
@@ -262,6 +269,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
262269
}
263270

264271
/**
272+
* PUT /user/{username}
265273
* Updated user
266274
* This can only be done by the logged in user.
267275
* @param username name that need to be deleted

samples/client/petstore/kotlin-jvm-ktor-kotlinx_serialization/src/main/kotlin/org/openapitools/client/apis/PetApi.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import io.ktor.http.ParametersBuilder
3535
) {
3636

3737
/**
38+
* POST /pet
3839
* Add a new pet to the store
3940
*
4041
* @param pet Pet object that needs to be added to the store
@@ -67,6 +68,7 @@ import io.ktor.http.ParametersBuilder
6768
}
6869

6970
/**
71+
* DELETE /pet/{petId}
7072
* Deletes a pet
7173
*
7274
* @param petId Pet id to delete
@@ -101,6 +103,7 @@ import io.ktor.http.ParametersBuilder
101103
}
102104

103105
/**
106+
* GET /pet/findByStatus
104107
* Finds Pets by status
105108
* Multiple status values can be provided with comma separated strings
106109
* @param status Status values that need to be considered for filter
@@ -135,6 +138,7 @@ import io.ktor.http.ParametersBuilder
135138
}
136139

137140
/**
141+
* GET /pet/findByTags
138142
* Finds Pets by tags
139143
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
140144
* @param tags Tags to filter by
@@ -169,6 +173,7 @@ import io.ktor.http.ParametersBuilder
169173
}
170174

171175
/**
176+
* GET /pet/{petId}
172177
* Find pet by ID
173178
* Returns a single pet
174179
* @param petId ID of pet to return
@@ -202,6 +207,7 @@ import io.ktor.http.ParametersBuilder
202207
}
203208

204209
/**
210+
* PUT /pet
205211
* Update an existing pet
206212
*
207213
* @param pet Pet object that needs to be added to the store
@@ -234,6 +240,7 @@ import io.ktor.http.ParametersBuilder
234240
}
235241

236242
/**
243+
* POST /pet/{petId}
237244
* Updates a pet in the store with form data
238245
*
239246
* @param petId ID of pet that needs to be updated
@@ -271,6 +278,7 @@ import io.ktor.http.ParametersBuilder
271278
}
272279

273280
/**
281+
* POST /pet/{petId}/uploadImage
274282
* uploads an image
275283
*
276284
* @param petId ID of pet to update

0 commit comments

Comments
 (0)