Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -164,5 +164,6 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("infrastructure/ResponseExtensions.kt.mustache", infrastructureFolder, "ResponseExtensions.kt"));
supportingFiles.add(new SupportingFile("infrastructure/Serializer.kt.mustache", infrastructureFolder, "Serializer.kt"));
supportingFiles.add(new SupportingFile("infrastructure/Errors.kt.mustache", infrastructureFolder, "Errors.kt"));
supportingFiles.add(new SupportingFile("infrastructure/ByteArrayAdapter.kt.mustache", infrastructureFolder, "ByteArrayAdapter.kt"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ open class ApiClient(val baseUrl: String) {
fun toJson(uuid: UUID) = uuid.toString()
@FromJson
fun fromJson(s: String) = UUID.fromString(s)
}).build().adapter(T::class.java).fromJson(body.source())
})
.add(ByteArrayAdapter())
.build().adapter(T::class.java).fromJson(body.source())
else -> TODO()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package {{packageName}}.infrastructure

import com.squareup.moshi.FromJson
import com.squareup.moshi.ToJson

class ByteArrayAdapter {
@ToJson
fun toJson(data: ByteArray): String = String(data)

@FromJson
fun fromJson(data: String): ByteArray = data.toByteArray()
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ open class ApiClient(val baseUrl: String) {
fun toJson(uuid: UUID) = uuid.toString()
@FromJson
fun fromJson(s: String) = UUID.fromString(s)
}).build().adapter(T::class.java).fromJson(body.source())
})
.add(ByteArrayAdapter())
.build().adapter(T::class.java).fromJson(body.source())
else -> TODO()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.openapitools.client.infrastructure

import com.squareup.moshi.FromJson
import com.squareup.moshi.ToJson

class ByteArrayAdapter {
@ToJson
fun toJson(data: ByteArray): String = String(data)

@FromJson
fun fromJson(data: String): ByteArray = data.toByteArray()
}