Yonatan Karp-Rudin 83af019603
Fix Retrofit template with Jackson for Kotlin (#14239)
* Fix Retrofit template with Jackson (Fix #8147)

This commit amends the `ApiClient` template for Retrofit. It fixes a bug where the Retrofit client uses Jackson as the serialization library.

Until now, the `ApiClient` could not be compiled when using the Jackson library (default in SpringBoot applications), as the constructor of the class had the following parameter:

`private val serializerBuilder: Builder = Serializer.Builder,`

The change done in the commit, is to ensure that in case of Jackson, the right property of the `Serializer` class is assigned

* Add sample code for `kotlin-jvm-jackson`

This commit adds a sample code for the `kotlin-jvm-jackson` generated code to test the changes on CI

* Update kotlin code samples for CI

This commit only runs the command `bin/generate-samples.sh bin/configs/kotlin-*` to ensure that all code samples are up-to-date and CI can pass successfully.
2023-08-14 10:06:49 +08:00

3.8 KiB

StoreApi

All URIs are relative to http://petstore.swagger.io/v2

Method HTTP request Description
deleteOrder DELETE store/order/{orderId} Delete purchase order by ID
getInventory GET store/inventory Returns pet inventories by status
getOrderById GET store/order/{orderId} Find purchase order by ID
placeOrder POST store/order Place an order for a pet

Delete purchase order by ID

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

Example

// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*

val apiClient = ApiClient()
val webService = apiClient.createWebservice(StoreApi::class.java)
val orderId : kotlin.String = orderId_example // kotlin.String | ID of the order that needs to be deleted

webService.deleteOrder(orderId)

Parameters

Name Type Description Notes
orderId kotlin.String ID of the order that needs to be deleted

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

Returns pet inventories by status

Returns a map of status codes to quantities

Example

// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*

val apiClient = ApiClient()
val webService = apiClient.createWebservice(StoreApi::class.java)

val result : kotlin.collections.Map<kotlin.String, kotlin.Int> = webService.getInventory()

Parameters

This endpoint does not need any parameter.

Return type

kotlin.collections.Map<kotlin.String, kotlin.Int>

Authorization

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

Find purchase order by ID

For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions

Example

// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*

val apiClient = ApiClient()
val webService = apiClient.createWebservice(StoreApi::class.java)
val orderId : kotlin.Long = 789 // kotlin.Long | ID of pet that needs to be fetched

val result : Order = webService.getOrderById(orderId)

Parameters

Name Type Description Notes
orderId kotlin.Long ID of pet that needs to be fetched

Return type

Order

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

Place an order for a pet

Example

// Import classes:
//import org.openapitools.client.*
//import org.openapitools.client.infrastructure.*
//import org.openapitools.client.models.*

val apiClient = ApiClient()
val webService = apiClient.createWebservice(StoreApi::class.java)
val order : Order =  // Order | order placed for purchasing the pet

val result : Order = webService.placeOrder(order)

Parameters

Name Type Description Notes
order Order order placed for purchasing the pet

Return type

Order

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/xml, application/json