Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kotlin][client] add sample for parcelizeModels #9394

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/configs/kotlin-json-request-string.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ templateDir: modules/openapi-generator/src/main/resources/kotlin-client
additionalProperties:
requestDateConverter: toString
artifactId: kotlin-petstore-json-request-string
parcelizeModels: true
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import kotlinx.serialization.Contextual
{{#parcelizeModels}}
import android.os.Parcelable
import kotlinx.parcelize.Parcelize

{{/parcelizeModels}}
{{/multiplatform}}
{{#multiplatform}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ buildscript {
}

apply plugin: 'kotlin'
apply plugin: 'kotlin-parcelize'

repositories {
maven { url "https://repo1.maven.org/maven2" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ 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
* @param code
* @param type
* @param message
*/
@Parcelize

data class ApiResponse (
@Json(name = "code")
Expand All @@ -28,5 +31,5 @@ data class ApiResponse (
val type: kotlin.String? = null,
@Json(name = "message")
val message: kotlin.String? = null
)
) : Parcelable

Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,6 +25,7 @@ import com.squareup.moshi.Json
* @param status Order Status
* @param complete
*/
@Parcelize

data class Order (
@Json(name = "id")
Expand All @@ -38,7 +41,7 @@ data class Order (
val status: Order.Status? = null,
@Json(name = "complete")
val complete: kotlin.Boolean? = null
) {
) : Parcelable {

/**
* Order Status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,6 +27,7 @@ import com.squareup.moshi.Json
* @param phone
* @param userStatus User Status
*/
@Parcelize

data class User (
@Json(name = "id")
Expand All @@ -44,5 +47,5 @@ data class User (
/* User Status */
@Json(name = "userStatus")
val userStatus: kotlin.Int? = null
)
) : Parcelable