Skip to content

Commit 35f52e4

Browse files
committed
Correct doc. Simplify some methods
1 parent 4bbfa14 commit 35f52e4

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/commonMain/kotlin/io/github/optimumcode/json/schema/OutputCollector.kt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ internal typealias OutputErrorTransformer<T> = OutputCollector<T>.(ValidationErr
1111
private val NO_TRANSFORMATION: OutputErrorTransformer<*> = { it }
1212

1313
/**
14-
* Provides collectors' implementations defined in [draft 2020-12](https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-01#section-12.4)
14+
* Provides collectors' implementations for outputs
15+
* defined in [draft 2020-12](https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-01#section-12.4)
1516
*/
1617
public sealed class OutputCollector<T> private constructor(
1718
parent: OutputCollector<T>? = null,
@@ -161,9 +162,8 @@ public sealed class OutputCollector<T> private constructor(
161162
canCollapse: Boolean,
162163
): OutputCollector<Nothing> = DelegateOutputCollector(errorCollector, this)
163164

164-
override fun withErrorTransformer(transformer: OutputErrorTransformer<Nothing>): OutputCollector<Nothing> {
165-
return DelegateOutputCollector(errorCollector, parent, transformer)
166-
}
165+
override fun withErrorTransformer(transformer: OutputErrorTransformer<Nothing>): OutputCollector<Nothing> =
166+
DelegateOutputCollector(errorCollector, parent, transformer)
167167

168168
override fun reportErrors() {
169169
if (!::reportedErrors.isInitialized) {
@@ -455,14 +455,13 @@ public sealed class OutputCollector<T> private constructor(
455455
)
456456
}
457457

458-
override fun updateLocation(path: JsonPointer): Verbose {
459-
return Verbose(
458+
override fun updateLocation(path: JsonPointer): Verbose =
459+
Verbose(
460460
location = path,
461461
keywordLocation = keywordLocation,
462462
absoluteLocation = absoluteLocation,
463463
parent = this,
464464
)
465-
}
466465

467466
override fun updateKeywordLocation(
468467
path: JsonPointer,
@@ -486,9 +485,8 @@ public sealed class OutputCollector<T> private constructor(
486485
)
487486
}
488487

489-
override fun childCollector(): OutputCollector<OutputUnit> {
490-
return Verbose(location, keywordLocation, this, absoluteLocation, child = true)
491-
}
488+
override fun childCollector(): OutputCollector<OutputUnit> =
489+
Verbose(location, keywordLocation, this, absoluteLocation, child = true)
492490

493491
override fun withErrorTransformer(transformer: OutputErrorTransformer<OutputUnit>): OutputCollector<OutputUnit> =
494492
Verbose(location, keywordLocation, parent, absoluteLocation, transformer = transformer)

0 commit comments

Comments
 (0)