Skip to content

Commit 03f9fdf

Browse files
author
yevhenii-nadtochii
committed
Rename the object
1 parent f06758f commit 03f9fdf

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

java-api/src/main/kotlin/io/spine/validation/api/MessageValidatorsDescriptor.kt renamed to java-api/src/main/kotlin/io/spine/validation/api/DiscoveredValidators.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ package io.spine.validation.api
2929
import io.spine.annotation.Internal
3030

3131
/**
32-
* A container for the discovered message validators.
32+
* Holds a path to a file with the discovered validators.
3333
*
34-
* Holds the resource path for the message-validators configuration file
35-
* used by the `:model` to generate the corresponding constraints.
34+
* KSP processor generates a resource file using the [RESOURCES_LOCATION].
35+
* Then, the codegen plugin picks up the file using the same location.
3636
*/
3737
@Internal
38-
public object MessageValidatorsDescriptor {
38+
public object DiscoveredValidators {
3939

4040
/**
41-
* The path in resources to the file with the discovered message validators.
41+
* The path to the file with the discovered message validators.
42+
*
43+
* The path is relative to the output directory of the KSP processor.
4244
*/
43-
public const val RESOURCES_LOCATION: String = "spine/validation/message-validators.txt"
45+
public const val RESOURCES_LOCATION: String = "spine/validation/message-validators"
4446
}

java-ksp/src/main/kotlin/io/spine/validation/java/ksp/ValidatorProcessor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ import com.google.devtools.ksp.symbol.KSAnnotation
3535
import com.google.devtools.ksp.symbol.KSClassDeclaration
3636
import com.google.devtools.ksp.symbol.KSType
3737
import com.google.devtools.ksp.symbol.KSTypeReference
38-
import io.spine.validation.api.MessageValidatorsDescriptor
38+
import io.spine.validation.api.DiscoveredValidators
3939
import io.spine.validation.api.Validator
4040

4141
internal class ValidatorProcessor(codeGenerator: CodeGenerator) : SymbolProcessor {
4242

4343
private val discoveredValidators = mutableSetOf<String>()
4444
private val output = codeGenerator.createNewFileByPath(
4545
dependencies = Dependencies(aggregating = true),
46-
path = MessageValidatorsDescriptor.RESOURCES_LOCATION,
46+
path = DiscoveredValidators.RESOURCES_LOCATION,
4747
extensionName = ""
4848
).writer()
4949

java/src/main/kotlin/io/spine/validation/java/JavaValidationPlugin.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ package io.spine.validation.java
2828

2929
import io.spine.protodata.java.ClassName
3030
import io.spine.validation.ValidationPlugin
31-
import io.spine.validation.api.MessageValidatorsDescriptor
31+
import io.spine.validation.api.DiscoveredValidators
3232
import io.spine.validation.api.ValidationOption
3333
import io.spine.validation.java.setonce.SetOnceRenderer
3434
import java.io.File
@@ -73,7 +73,7 @@ private val customOptions by lazy {
7373
private val customValidators by lazy {
7474
val protoDataWorkingDir = System.getProperty("user.dir")
7575
val kspOutput = "$protoDataWorkingDir/$KSP_GENERATED_RESOURCES"
76-
val messageValidatorsPath = "$kspOutput/${MessageValidatorsDescriptor.RESOURCES_LOCATION}"
76+
val messageValidatorsPath = "$kspOutput/${DiscoveredValidators.RESOURCES_LOCATION}"
7777
val messageValidators = File(messageValidatorsPath)
7878
if (!messageValidators.exists()) {
7979
return@lazy emptyMap()

0 commit comments

Comments
 (0)