Skip to content

Commit fd0f621

Browse files
committed
Prepare paint without parentheses testcase
1 parent 1a487d8 commit fd0f621

42 files changed

Lines changed: 3512 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import io.github.ermadmi78.kobby.kobby
2+
3+
repositories {
4+
mavenLocal()
5+
mavenCentral()
6+
}
7+
8+
buildscript {
9+
repositories {
10+
mavenLocal()
11+
mavenCentral()
12+
}
13+
}
14+
15+
plugins {
16+
kotlin("jvm") version "testKotlinVersion"
17+
id("io.github.ermadmi78.kobby")
18+
}
19+
20+
kobby {
21+
kotlin {
22+
entity {
23+
projection {
24+
// todo enableNotationWithoutParentheses = true
25+
}
26+
}
27+
}
28+
}
29+
30+
dependencies {
31+
// Add this dependency to enable Jackson annotation generation in DTO classes by Kobby
32+
compileOnly("com.fasterxml.jackson.core:jackson-annotations:testJacksonVersion")
33+
34+
// Add this dependencies to remove warning "Runtime JAR files in the classpath should have the same version"
35+
compileOnly(kotlin("stdlib"))
36+
compileOnly(kotlin("stdlib-jdk7"))
37+
compileOnly(kotlin("reflect"))
38+
}
39+
40+
tasks {
41+
jar {
42+
enabled = false
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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.Boolean
23+
import kotlin.Int
24+
import kotlin.Long
25+
import kotlin.Suppress
26+
import kotlin.Unit
27+
import kotlin.also
28+
import kotlin.apply
29+
30+
@JsonTypeName(value = "Circle")
31+
@JsonTypeInfo(
32+
use = JsonTypeInfo.Id.NAME,
33+
include = JsonTypeInfo.As.PROPERTY,
34+
property = "__typename",
35+
defaultImpl = CircleDto::class,
36+
)
37+
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
38+
public data class CircleDto(
39+
override val id: Long? = null,
40+
override val opaque: Boolean? = null,
41+
public val radius: Int? = null,
42+
) : ShapeDto
43+
44+
public fun CircleDto.toBuilder(): CircleDtoBuilder = CircleDtoBuilder().also {
45+
it.id = this.id
46+
it.opaque = this.opaque
47+
it.radius = this.radius
48+
}
49+
50+
public fun CircleDtoBuilder.toDto(): CircleDto = CircleDto(
51+
id,
52+
opaque,
53+
radius
54+
)
55+
56+
public fun CircleDto(block: CircleDtoBuilder.() -> Unit): CircleDto =
57+
CircleDtoBuilder().apply(block).toDto()
58+
59+
public fun CircleDto.copy(block: CircleDtoBuilder.() -> Unit): CircleDto =
60+
toBuilder().apply(block).toDto()
61+
62+
@PaintDSL
63+
public class CircleDtoBuilder {
64+
public var id: Long? = null
65+
66+
public var opaque: Boolean? = null
67+
68+
public var radius: Int? = null
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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 io.github.ermadmi78.kobby.testcases.paint_without_parentheses.kobby.kotlin.PaintDSL
20+
import kotlin.Boolean
21+
import kotlin.Int
22+
import kotlin.Long
23+
import kotlin.Suppress
24+
import kotlin.Unit
25+
import kotlin.also
26+
import kotlin.apply
27+
import kotlin.collections.List
28+
import kotlin.error
29+
30+
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
31+
public data class CircleInput(
32+
public val tempId: List<Long>,
33+
public val opaque: Boolean,
34+
public val radius: Int,
35+
)
36+
37+
public fun CircleInput.toBuilder(): CircleInputBuilder = CircleInputBuilder().also {
38+
it.tempId = this.tempId
39+
it.opaque = this.opaque
40+
it.radius = this.radius
41+
}
42+
43+
public fun CircleInputBuilder.toInput(): CircleInput = CircleInput(
44+
tempId ?: error("CircleInput: 'tempId' must not be null"),
45+
opaque ?: error("CircleInput: 'opaque' must not be null"),
46+
radius ?: error("CircleInput: 'radius' must not be null")
47+
)
48+
49+
public fun CircleInput(block: CircleInputBuilder.() -> Unit): CircleInput =
50+
CircleInputBuilder().apply(block).toInput()
51+
52+
public fun CircleInput.copy(block: CircleInputBuilder.() -> Unit): CircleInput =
53+
toBuilder().apply(block).toInput()
54+
55+
@PaintDSL
56+
public class CircleInputBuilder {
57+
public var tempId: List<Long>? = null
58+
59+
public var opaque: Boolean? = null
60+
61+
public var radius: Int? = null
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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`.JsonSubTypes
19+
import com.fasterxml.jackson.`annotation`.JsonTypeInfo
20+
import kotlin.Suppress
21+
22+
@JsonTypeInfo(
23+
use = JsonTypeInfo.Id.NAME,
24+
include = JsonTypeInfo.As.PROPERTY,
25+
property = "__typename",
26+
)
27+
@JsonSubTypes(
28+
JsonSubTypes.Type(value = SquareDto::class, name = "Square"),
29+
JsonSubTypes.Type(value = RectangleDto::class, name = "Rectangle"),
30+
)
31+
public interface PolygonDto
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
import kotlin.collections.List
27+
28+
@JsonTypeName(value = "Query")
29+
@JsonTypeInfo(
30+
use = JsonTypeInfo.Id.NAME,
31+
include = JsonTypeInfo.As.PROPERTY,
32+
property = "__typename",
33+
defaultImpl = QueryDto::class,
34+
)
35+
@JsonInclude(value = JsonInclude.Include.NON_ABSENT)
36+
public data class QueryDto(
37+
public val shape: ShapeDto? = null,
38+
public val shapes: List<ShapeDto>? = null,
39+
public val polygons: List<PolygonDto>? = null,
40+
)
41+
42+
public fun QueryDto.toBuilder(): QueryDtoBuilder = QueryDtoBuilder().also {
43+
it.shape = this.shape
44+
it.shapes = this.shapes
45+
it.polygons = this.polygons
46+
}
47+
48+
public fun QueryDtoBuilder.toDto(): QueryDto = QueryDto(
49+
shape,
50+
shapes,
51+
polygons
52+
)
53+
54+
public fun QueryDto(block: QueryDtoBuilder.() -> Unit): QueryDto =
55+
QueryDtoBuilder().apply(block).toDto()
56+
57+
public fun QueryDto.copy(block: QueryDtoBuilder.() -> Unit): QueryDto =
58+
toBuilder().apply(block).toDto()
59+
60+
@PaintDSL
61+
public class QueryDtoBuilder {
62+
public var shape: ShapeDto? = null
63+
64+
public var shapes: List<ShapeDto>? = null
65+
66+
public var polygons: List<PolygonDto>? = null
67+
}

0 commit comments

Comments
 (0)