mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-08 08:30:56 +00:00
[kotlin][client] add sample for parcelizeModels (#9394)
This commit is contained in:
parent
456023b77c
commit
c4c15cecb6
@ -5,3 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/kotlin-client
|
||||
additionalProperties:
|
||||
requestDateConverter: toString
|
||||
artifactId: kotlin-petstore-json-request-string
|
||||
parcelizeModels: true
|
||||
|
@ -25,7 +25,6 @@ import kotlinx.serialization.Contextual
|
||||
{{#parcelizeModels}}
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
{{/parcelizeModels}}
|
||||
{{/multiplatform}}
|
||||
{{#multiplatform}}
|
||||
|
@ -18,6 +18,7 @@ buildscript {
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo1.maven.org/maven2" }
|
||||
|
@ -13,6 +13,8 @@ package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
@ -20,6 +22,7 @@ import com.squareup.moshi.Json
|
||||
* @param type
|
||||
* @param message
|
||||
*/
|
||||
@Parcelize
|
||||
|
||||
data class ApiResponse (
|
||||
@Json(name = "code")
|
||||
@ -28,5 +31,5 @@ data class ApiResponse (
|
||||
val type: kotlin.String? = null,
|
||||
@Json(name = "message")
|
||||
val message: kotlin.String? = null
|
||||
)
|
||||
) : Parcelable
|
||||
|
||||
|
@ -13,17 +13,20 @@ package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* A category for a pet
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
@Parcelize
|
||||
|
||||
data class Category (
|
||||
@Json(name = "id")
|
||||
val id: kotlin.Long? = null,
|
||||
@Json(name = "name")
|
||||
val name: kotlin.String? = null
|
||||
)
|
||||
) : Parcelable
|
||||
|
||||
|
@ -13,6 +13,8 @@ package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
@ -23,6 +25,7 @@ import com.squareup.moshi.Json
|
||||
* @param status Order Status
|
||||
* @param complete
|
||||
*/
|
||||
@Parcelize
|
||||
|
||||
data class Order (
|
||||
@Json(name = "id")
|
||||
@ -38,7 +41,7 @@ data class Order (
|
||||
val status: Order.Status? = null,
|
||||
@Json(name = "complete")
|
||||
val complete: kotlin.Boolean? = null
|
||||
) {
|
||||
) : Parcelable {
|
||||
|
||||
/**
|
||||
* Order Status
|
||||
|
@ -15,6 +15,8 @@ import org.openapitools.client.models.Category
|
||||
import org.openapitools.client.models.Tag
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
@ -25,6 +27,7 @@ import com.squareup.moshi.Json
|
||||
* @param tags
|
||||
* @param status pet status in the store
|
||||
*/
|
||||
@Parcelize
|
||||
|
||||
data class Pet (
|
||||
@Json(name = "name")
|
||||
@ -40,7 +43,7 @@ data class Pet (
|
||||
/* pet status in the store */
|
||||
@Json(name = "status")
|
||||
val status: Pet.Status? = null
|
||||
) {
|
||||
) : Parcelable {
|
||||
|
||||
/**
|
||||
* pet status in the store
|
||||
|
@ -13,17 +13,20 @@ package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* A tag for a pet
|
||||
* @param id
|
||||
* @param name
|
||||
*/
|
||||
@Parcelize
|
||||
|
||||
data class Tag (
|
||||
@Json(name = "id")
|
||||
val id: kotlin.Long? = null,
|
||||
@Json(name = "name")
|
||||
val name: kotlin.String? = null
|
||||
)
|
||||
) : Parcelable
|
||||
|
||||
|
@ -13,6 +13,8 @@ package org.openapitools.client.models
|
||||
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* A User who is purchasing from the pet store
|
||||
@ -25,6 +27,7 @@ import com.squareup.moshi.Json
|
||||
* @param phone
|
||||
* @param userStatus User Status
|
||||
*/
|
||||
@Parcelize
|
||||
|
||||
data class User (
|
||||
@Json(name = "id")
|
||||
@ -44,5 +47,5 @@ data class User (
|
||||
/* User Status */
|
||||
@Json(name = "userStatus")
|
||||
val userStatus: kotlin.Int? = null
|
||||
)
|
||||
) : Parcelable
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user