Merge pull request #277 from InsanusMokrassar/0.19.5

0.19.5
This commit is contained in:
InsanusMokrassar 2023-06-20 20:22:33 +06:00 committed by GitHub
commit a4b54e861d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 10 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 0.19.5
* `Repos`:
* `Generator`:
* Fixes in new type generation
## 0.19.4
* `Versions`:

View File

@ -14,5 +14,5 @@ crypto_js_version=4.1.1
# Project data
group=dev.inmo
version=0.19.4
android_code_version=200
version=0.19.5
android_code_version=201

View File

@ -100,7 +100,11 @@ class Processor(
primaryConstructor(
FunSpec.constructorBuilder().apply {
ksClassProperties.forEach {
addParameter(it.simpleName.getShortName(), it.typeName)
addParameter(
ParameterSpec.builder(it.simpleName.getShortName(), it.typeName).apply {
annotations += it.annotations.map { it.toAnnotationSpec() }
}.build()
)
typeBuilder.addProperty(
PropertySpec.builder(it.simpleName.getShortName(), it.typeName, KModifier.OVERRIDE).apply {
initializer(it.simpleName.getShortName())

View File

@ -11,18 +11,20 @@ import kotlinx.serialization.Serializable
@Serializable
@SerialName(value = "NewTest")
public data class NewTest(
public override val property1: String,
public override val property2: Int,
public override val parent: ParentTypeId?,
override val property1: String,
override val property2: Int,
@Serializable
override val parent: ParentTypeId?,
) : Test
@Serializable
@SerialName(value = "RegisteredTest")
public data class RegisteredTest(
public override val id: TestId,
public override val property1: String,
public override val property2: Int,
public override val parent: ParentTypeId?,
override val id: TestId,
override val property1: String,
override val property2: Int,
@Serializable
override val parent: ParentTypeId?,
) : Test, IRegisteredTest
public fun Test.asNew(): NewTest = NewTest(property1, property2, parent)

View File

@ -17,6 +17,7 @@ typealias ParentTypeId = TestId
sealed interface Test {
val property1: String
val property2: Int
@Serializable
val parent: ParentTypeId?
@GenerateCRUDModelExcludeOverride