Skip to content

Commit a58d77a

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

File tree

27 files changed

+143
-0
lines changed

27 files changed

+143
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ import okhttp3.MultipartBody
131131
{{/isEnum}}
132132
{{/allParams}}
133133
/**
134+
* {{{httpMethod}}} {{{path}}}
134135
* {{summary}}
135136
* {{notes}}
136137
* Responses:{{#responses}}

samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/AuthApi.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.google.gson.annotations.SerializedName
99

1010
interface AuthApi {
1111
/**
12+
* POST auth/http/basic
1213
* To test HTTP basic authentication
1314
* To test HTTP basic authentication
1415
* Responses:
@@ -20,6 +21,7 @@ interface AuthApi {
2021
suspend fun testAuthHttpBasic(): Response<kotlin.String>
2122

2223
/**
24+
* POST auth/http/bearer
2325
* To test HTTP bearer authentication
2426
* To test HTTP bearer authentication
2527
* Responses:

samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/BodyApi.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import okhttp3.MultipartBody
1414

1515
interface BodyApi {
1616
/**
17+
* POST binary/gif
1718
* Test binary (gif) response body
1819
* Test binary (gif) response body
1920
* Responses:
@@ -25,6 +26,7 @@ interface BodyApi {
2526
suspend fun testBinaryGif(): Response<ResponseBody>
2627

2728
/**
29+
* POST body/application/octetstream/binary
2830
* Test body parameter(s)
2931
* Test body parameter(s)
3032
* Responses:
@@ -37,6 +39,7 @@ interface BodyApi {
3739
suspend fun testBodyApplicationOctetstreamBinary(@Body body: RequestBody? = null): Response<kotlin.String>
3840

3941
/**
42+
* POST body/application/octetstream/array_of_binary
4043
* Test array of binary in multipart mime
4144
* Test array of binary in multipart mime
4245
* Responses:
@@ -50,6 +53,7 @@ interface BodyApi {
5053
suspend fun testBodyMultipartFormdataArrayOfBinary(@Part files: MultipartBody.Part): Response<kotlin.String>
5154

5255
/**
56+
* POST body/application/octetstream/single_binary
5357
* Test single binary in multipart mime
5458
* Test single binary in multipart mime
5559
* Responses:
@@ -63,6 +67,7 @@ interface BodyApi {
6367
suspend fun testBodyMultipartFormdataSingleBinary(@Part myFile: MultipartBody.Part? = null): Response<kotlin.String>
6468

6569
/**
70+
* POST echo/body/FreeFormObject/response_string
6671
* Test free form object
6772
* Test free form object
6873
* Responses:
@@ -75,6 +80,7 @@ interface BodyApi {
7580
suspend fun testEchoBodyFreeFormObjectResponseString(@Body body: kotlin.Any? = null): Response<kotlin.String>
7681

7782
/**
83+
* POST echo/body/Pet
7884
* Test body parameter(s)
7985
* Test body parameter(s)
8086
* Responses:
@@ -87,6 +93,7 @@ interface BodyApi {
8793
suspend fun testEchoBodyPet(@Body apiPet: ApiPet? = null): Response<ApiPet>
8894

8995
/**
96+
* POST echo/body/Pet/response_string
9097
* Test empty response body
9198
* Test empty response body
9299
* Responses:
@@ -99,6 +106,7 @@ interface BodyApi {
99106
suspend fun testEchoBodyPetResponseString(@Body apiPet: ApiPet? = null): Response<kotlin.String>
100107

101108
/**
109+
* POST echo/body/Tag/response_string
102110
* Test empty json (request body)
103111
* Test empty json (request body)
104112
* Responses:

samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/FormApi.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.google.gson.annotations.SerializedName
99

1010
interface FormApi {
1111
/**
12+
* POST form/integer/boolean/string
1213
* Test form parameter(s)
1314
* Test form parameter(s)
1415
* Responses:
@@ -24,6 +25,7 @@ interface FormApi {
2425
suspend fun testFormIntegerBooleanString(@Field("integer_form") integerForm: kotlin.Int? = null, @Field("boolean_form") booleanForm: kotlin.Boolean? = null, @Field("string_form") stringForm: kotlin.String? = null): Response<kotlin.String>
2526

2627
/**
28+
* POST form/oneof
2729
* Test form parameter(s) for oneOf schema
2830
* Test form parameter(s) for oneOf schema
2931
* Responses:

samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/HeaderApi.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface HeaderApi {
2020
}
2121

2222
/**
23+
* GET header/integer/boolean/string/enums
2324
* Test header parameter(s)
2425
* Test header parameter(s)
2526
* Responses:

samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/PathApi.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ interface PathApi {
2020
}
2121

2222
/**
23+
* GET path/string/{path_string}/integer/{path_integer}/{enum_nonref_string_path}/{enum_ref_string_path}
2324
* Test path parameter(s)
2425
* Test path parameter(s)
2526
* Responses:

samples/client/echo_api/kotlin-model-prefix-type-mappings/src/main/kotlin/org/openapitools/client/apis/QueryApi.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface QueryApi {
2424
}
2525

2626
/**
27+
* GET query/enum_ref_string
2728
* Test query parameter(s)
2829
* Test query parameter(s)
2930
* Responses:
@@ -37,6 +38,7 @@ interface QueryApi {
3738
suspend fun testEnumRefString(@Query("enum_nonref_string_query") enumNonrefStringQuery: EnumNonrefStringQueryTestEnumRefString? = null, @Query("enum_ref_string_query") enumRefStringQuery: ApiStringEnumRef? = null): Response<kotlin.String>
3839

3940
/**
41+
* GET query/datetime/date/string
4042
* Test query parameter(s)
4143
* Test query parameter(s)
4244
* Responses:
@@ -51,6 +53,7 @@ interface QueryApi {
5153
suspend fun testQueryDatetimeDateString(@Query("datetime_query") datetimeQuery: java.time.OffsetDateTime? = null, @Query("date_query") dateQuery: java.time.LocalDate? = null, @Query("string_query") stringQuery: kotlin.String? = null): Response<kotlin.String>
5254

5355
/**
56+
* GET query/integer/boolean/string
5457
* Test query parameter(s)
5558
* Test query parameter(s)
5659
* Responses:
@@ -65,6 +68,7 @@ interface QueryApi {
6568
suspend fun testQueryIntegerBooleanString(@Query("integer_query") integerQuery: kotlin.Int? = null, @Query("boolean_query") booleanQuery: kotlin.Boolean? = null, @Query("string_query") stringQuery: kotlin.String? = null): Response<kotlin.String>
6669

6770
/**
71+
* GET query/style_deepObject/explode_true/object
6872
* Test query parameter(s)
6973
* Test query parameter(s)
7074
* Responses:
@@ -77,6 +81,7 @@ interface QueryApi {
7781
suspend fun testQueryStyleDeepObjectExplodeTrueObject(@Query("query_object") queryObject: ApiPet? = null): Response<kotlin.String>
7882

7983
/**
84+
* GET query/style_form/explode_true/array_string
8085
* Test query parameter(s)
8186
* Test query parameter(s)
8287
* Responses:
@@ -89,6 +94,7 @@ interface QueryApi {
8994
suspend fun testQueryStyleFormExplodeTrueArrayString(@Query("values") values: kotlin.collections.List<kotlin.String>? = null): Response<kotlin.String>
9095

9196
/**
97+
* GET query/style_form/explode_true/object
9298
* Test query parameter(s)
9399
* Test query parameter(s)
94100
* Responses:

samples/client/petstore/kotlin-default-values-jvm-retrofit2/src/main/kotlin/org/openapitools/client/apis/DefaultApi.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.squareup.moshi.Json
99

1010
interface DefaultApi {
1111
/**
12+
* POST test
1213
* Tests default values
1314
* Tests default values of different parameters
1415
* Responses:

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import okhttp3.MultipartBody
1313

1414
interface PetApi {
1515
/**
16+
* POST pet
1617
* Add a new pet to the store
1718
*
1819
* Responses:
@@ -26,6 +27,7 @@ interface PetApi {
2627
fun addPet(@Body pet: Pet): Call<Pet>
2728

2829
/**
30+
* DELETE pet/{petId}
2931
* Deletes a pet
3032
*
3133
* Responses:
@@ -49,6 +51,7 @@ interface PetApi {
4951
}
5052

5153
/**
54+
* GET pet/findByStatus
5255
* Finds Pets by status
5356
* Multiple status values can be provided with comma separated strings
5457
* Responses:
@@ -62,6 +65,7 @@ interface PetApi {
6265
fun findPetsByStatus(@Query("status") status: CSVParams): Call<kotlin.collections.List<Pet>>
6366

6467
/**
68+
* GET pet/findByTags
6569
* Finds Pets by tags
6670
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
6771
* Responses:
@@ -76,6 +80,7 @@ interface PetApi {
7680
fun findPetsByTags(@Query("tags") tags: CSVParams): Call<kotlin.collections.List<Pet>>
7781

7882
/**
83+
* GET pet/{petId}
7984
* Find pet by ID
8085
* Returns a single pet
8186
* Responses:
@@ -90,6 +95,7 @@ interface PetApi {
9095
fun getPetById(@Path("petId") petId: kotlin.Long): Call<Pet>
9196

9297
/**
98+
* PUT pet
9399
* Update an existing pet
94100
*
95101
* Responses:
@@ -105,6 +111,7 @@ interface PetApi {
105111
fun updatePet(@Body pet: Pet): Call<Pet>
106112

107113
/**
114+
* POST pet/{petId}
108115
* Updates a pet in the store with form data
109116
*
110117
* Responses:
@@ -120,6 +127,7 @@ interface PetApi {
120127
fun updatePetWithForm(@Path("petId") petId: kotlin.Long, @Field("name") name: kotlin.String? = null, @Field("status") status: kotlin.String? = null): Call<Unit>
121128

122129
/**
130+
* POST pet/{petId}/uploadImage
123131
* uploads an image
124132
*
125133
* Responses:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.openapitools.client.models.Order
1010

1111
interface StoreApi {
1212
/**
13+
* DELETE store/order/{orderId}
1314
* Delete purchase order by ID
1415
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
1516
* Responses:
@@ -23,6 +24,7 @@ interface StoreApi {
2324
fun deleteOrder(@Path("orderId") orderId: kotlin.String): Call<Unit>
2425

2526
/**
27+
* GET store/inventory
2628
* Returns pet inventories by status
2729
* Returns a map of status codes to quantities
2830
* Responses:
@@ -34,6 +36,7 @@ interface StoreApi {
3436
fun getInventory(): Call<kotlin.collections.Map<kotlin.String, kotlin.Int>>
3537

3638
/**
39+
* GET store/order/{orderId}
3740
* Find purchase order by ID
3841
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generate exceptions
3942
* Responses:
@@ -48,6 +51,7 @@ interface StoreApi {
4851
fun getOrderById(@Path("orderId") orderId: kotlin.Long): Call<Order>
4952

5053
/**
54+
* POST store/order
5155
* Place an order for a pet
5256
*
5357
* Responses:

0 commit comments

Comments
 (0)