|
| 1 | +@file:Suppress( |
| 2 | + "RedundantVisibilityModifier", |
| 3 | + "RedundantUnitReturnType", |
| 4 | + "FunctionName", |
| 5 | + "PropertyName", |
| 6 | + "ObjectPropertyName", |
| 7 | + "MemberVisibilityCanBePrivate", |
| 8 | + "ConstantConditionIf", |
| 9 | + "CanBeParameter", |
| 10 | + "unused", |
| 11 | + "RemoveExplicitTypeArguments", |
| 12 | + "RedundantSuppression", |
| 13 | + "KotlinRedundantDiagnosticSuppress", |
| 14 | +) |
| 15 | + |
| 16 | +package io.github.ermadmi78.kobby.testcases.paint_without_parentheses.kobby.kotlin.dto |
| 17 | + |
| 18 | +import com.fasterxml.jackson.`annotation`.JsonInclude |
| 19 | +import com.fasterxml.jackson.`annotation`.JsonTypeInfo |
| 20 | +import com.fasterxml.jackson.`annotation`.JsonTypeName |
| 21 | +import io.github.ermadmi78.kobby.testcases.paint_without_parentheses.kobby.kotlin.PaintDSL |
| 22 | +import kotlin.Suppress |
| 23 | +import kotlin.Unit |
| 24 | +import kotlin.also |
| 25 | +import kotlin.apply |
| 26 | + |
| 27 | +@JsonTypeName(value = "Mutation") |
| 28 | +@JsonTypeInfo( |
| 29 | + use = JsonTypeInfo.Id.NAME, |
| 30 | + include = JsonTypeInfo.As.PROPERTY, |
| 31 | + property = "__typename", |
| 32 | + defaultImpl = MutationDto::class, |
| 33 | +) |
| 34 | +@JsonInclude(value = JsonInclude.Include.NON_ABSENT) |
| 35 | +public data class MutationDto( |
| 36 | + public val createCircle: CircleDto? = null, |
| 37 | + public val createSquare: SquareDto? = null, |
| 38 | + public val createRectangle: RectangleDto? = null, |
| 39 | +) |
| 40 | + |
| 41 | +public fun MutationDto.toBuilder(): MutationDtoBuilder = MutationDtoBuilder().also { |
| 42 | + it.createCircle = this.createCircle |
| 43 | + it.createSquare = this.createSquare |
| 44 | + it.createRectangle = this.createRectangle |
| 45 | +} |
| 46 | + |
| 47 | +public fun MutationDtoBuilder.toDto(): MutationDto = MutationDto( |
| 48 | + createCircle, |
| 49 | + createSquare, |
| 50 | + createRectangle |
| 51 | +) |
| 52 | + |
| 53 | +public fun MutationDto(block: MutationDtoBuilder.() -> Unit): MutationDto = |
| 54 | + MutationDtoBuilder().apply(block).toDto() |
| 55 | + |
| 56 | +public fun MutationDto.copy(block: MutationDtoBuilder.() -> Unit): MutationDto = |
| 57 | + toBuilder().apply(block).toDto() |
| 58 | + |
| 59 | +@PaintDSL |
| 60 | +public class MutationDtoBuilder { |
| 61 | + public var createCircle: CircleDto? = null |
| 62 | + |
| 63 | + public var createSquare: SquareDto? = null |
| 64 | + |
| 65 | + public var createRectangle: RectangleDto? = null |
| 66 | +} |
0 commit comments