@@ -38,7 +38,7 @@ class TypeInferenceTest : ShouldSpec({
38
38
data class Test2 <T >(val vala2: T , val para2: Pair <T , String >)
39
39
data class Test <T >(val vala: T , val tripl1: Triple <T , Test2 <Long >, T >)
40
40
41
- val struct = Struct .fromJson(schema(typeOf <Pair <String , Test <Int >>>()).prettyJson())!!
41
+ val struct = Struct .fromJson(kotlinEncoderFor <Pair <String , Test <Int >>>().schema( ).prettyJson())!!
42
42
should("contain correct typings") {
43
43
expect(struct.fields).notToEqualNull().toContain.inAnyOrder.only.entries(
44
44
hasField("first", "string"),
@@ -68,7 +68,7 @@ class TypeInferenceTest : ShouldSpec({
68
68
data class Test2 <T >(val vala2: T , val para2: Pair <T , Single <Double >>)
69
69
data class Test <T >(val vala: T , val tripl1: Triple <T , Test2 <Long >, T >)
70
70
71
- val struct = Struct .fromJson(schema(typeOf <Pair <String , Test <Int >>>()).prettyJson())!!
71
+ val struct = Struct .fromJson(kotlinEncoderFor <Pair <String , Test <Int >>>().schema( ).prettyJson())!!
72
72
should("contain correct typings") {
73
73
expect(struct.fields).notToEqualNull().toContain.inAnyOrder.only.entries(
74
74
hasField("first", "string"),
@@ -99,7 +99,7 @@ class TypeInferenceTest : ShouldSpec({
99
99
context("org.jetbrains.spark.api.org.jetbrains.spark.api.schema without generics") {
100
100
data class Test (val a: String , val b: Int , val c: Double )
101
101
102
- val struct = Struct .fromJson(schema(typeOf <Test >()).prettyJson())!!
102
+ val struct = Struct .fromJson(kotlinEncoderFor <Test >().schema( ).prettyJson())!!
103
103
should("return correct types too") {
104
104
expect(struct.fields).notToEqualNull().toContain.inAnyOrder.only.entries(
105
105
hasField("a", "string"),
@@ -109,7 +109,7 @@ class TypeInferenceTest : ShouldSpec({
109
109
}
110
110
}
111
111
context("type with list of ints") {
112
- val struct = Struct .fromJson(schema(typeOf <List <Int >>()).prettyJson())!!
112
+ val struct = Struct .fromJson(kotlinEncoderFor <List <Int >>().schema( ).prettyJson())!!
113
113
should("return correct types too") {
114
114
expect(struct) {
115
115
isOfType("array")
@@ -118,7 +118,7 @@ class TypeInferenceTest : ShouldSpec({
118
118
}
119
119
}
120
120
context("type with list of Pairs int to long") {
121
- val struct = Struct .fromJson(schema(typeOf <List <Pair <Int , Long >>>()).prettyJson())!!
121
+ val struct = Struct .fromJson(kotlinEncoderFor <List <Pair <Int , Long >>>().schema( ).prettyJson())!!
122
122
should("return correct types too") {
123
123
expect(struct) {
124
124
isOfType("array")
@@ -134,7 +134,7 @@ class TypeInferenceTest : ShouldSpec({
134
134
context("type with list of generic data class with E generic name") {
135
135
data class Test <E >(val e: E )
136
136
137
- val struct = Struct .fromJson(schema(typeOf <List <Test <String >>>()).prettyJson())!!
137
+ val struct = Struct .fromJson(kotlinEncoderFor <List <Test <String >>>().schema( ).prettyJson())!!
138
138
should("return correct types too") {
139
139
expect(struct) {
140
140
isOfType("array")
@@ -147,7 +147,7 @@ class TypeInferenceTest : ShouldSpec({
147
147
}
148
148
}
149
149
context("type with list of list of int") {
150
- val struct = Struct .fromJson(schema(typeOf <List <List <Int >>>()).prettyJson())!!
150
+ val struct = Struct .fromJson(kotlinEncoderFor <List <List <Int >>>().schema( ).prettyJson())!!
151
151
should("return correct types too") {
152
152
expect(struct) {
153
153
isOfType("array")
@@ -158,7 +158,7 @@ class TypeInferenceTest : ShouldSpec({
158
158
}
159
159
}
160
160
context("Subtypes of list") {
161
- val struct = Struct .fromJson(schema(typeOf <ArrayList <Int >>()).prettyJson())!!
161
+ val struct = Struct .fromJson(kotlinEncoderFor <ArrayList <Int >>().schema( ).prettyJson())!!
162
162
should("return correct types too") {
163
163
expect(struct) {
164
164
isOfType("array")
@@ -168,7 +168,7 @@ class TypeInferenceTest : ShouldSpec({
168
168
}
169
169
}
170
170
context("Subtypes of list with nullable values") {
171
- val struct = Struct .fromJson(schema(typeOf <ArrayList <Int ?>>()).prettyJson())!!
171
+ val struct = Struct .fromJson(kotlinEncoderFor <ArrayList <Int ?>>().schema( ).prettyJson())!!
172
172
should("return correct types too") {
173
173
expect(struct) {
174
174
isOfType("array")
@@ -180,7 +180,7 @@ class TypeInferenceTest : ShouldSpec({
180
180
context("data class with props in order lon → lat") {
181
181
data class Test (val lon: Double , val lat: Double )
182
182
183
- val struct = Struct .fromJson(schema(typeOf <Test >()).prettyJson())!!
183
+ val struct = Struct .fromJson(kotlinEncoderFor <Test >().schema( ).prettyJson())!!
184
184
should("Not change order of fields") {
185
185
expect(struct.fields).notToEqualNull().containsExactly(
186
186
hasField("lon", "double"),
@@ -191,7 +191,7 @@ class TypeInferenceTest : ShouldSpec({
191
191
context("data class with nullable list inside") {
192
192
data class Sample (val optionList: List <Int >? )
193
193
194
- val struct = Struct .fromJson(schema(typeOf <Sample >()).prettyJson())!!
194
+ val struct = Struct .fromJson(kotlinEncoderFor <Sample >().schema( ).prettyJson())!!
195
195
196
196
should("show that list is nullable and element is not") {
197
197
expect(struct)
@@ -213,7 +213,7 @@ class TypeInferenceTest : ShouldSpec({
213
213
}
214
214
215
215
should("generate valid serializer schema") {
216
- expect(encoder <Sample >().schema()) {
216
+ expect(kotlinEncoderFor <Sample >().schema()) {
217
217
this
218
218
.feature("data type", { this.fields()?.toList() }) {
219
219
this.notToEqualNull().toContain.inOrder.only.entry {
0 commit comments