Skip to content

Commit 3aa2f1d

Browse files
[NU-2109] Remove unknown scenario property validation (#7757)
1 parent 6f763e6 commit 3aa2f1d

File tree

5 files changed

+2
-81
lines changed

5 files changed

+2
-81
lines changed

designer/server/src/main/scala/pl/touk/nussknacker/ui/validation/ScenarioPropertiesValidator.scala

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import cats.data.Validated.{invalid, valid, Invalid, Valid}
55
import pl.touk.nussknacker.engine.api.NodeId
66
import pl.touk.nussknacker.engine.api.component.ScenarioPropertyConfig
77
import pl.touk.nussknacker.engine.api.context.PartSubGraphCompilationError
8-
import pl.touk.nussknacker.engine.api.context.ProcessCompilationError.{MissingRequiredProperty, UnknownProperty}
8+
import pl.touk.nussknacker.engine.api.context.ProcessCompilationError.MissingRequiredProperty
99
import pl.touk.nussknacker.engine.api.definition.{MandatoryParameterValidator, ParameterValidator}
1010
import pl.touk.nussknacker.engine.api.parameter.ParameterName
1111
import pl.touk.nussknacker.engine.graph.expression.Expression
@@ -34,9 +34,8 @@ class ScenarioPropertiesValidator(
3434
val validated = (
3535
getConfiguredValidationsResults(finalizedScenarioPropertiesConfig, scenarioProperties),
3636
getMissingRequiredPropertyValidationResults(finalizedScenarioPropertiesConfig, scenarioProperties),
37-
getUnknownPropertyValidationResults(finalizedScenarioPropertiesConfig, scenarioProperties)
3837
)
39-
.mapN { (_, _, _) => () }
38+
.mapN { (_, _) => () }
4039

4140
val processPropertiesErrors = validated match {
4241
case Invalid(e) => e.map(error => PrettyValidationErrors.formatErrorMessage(error)).toList
@@ -96,19 +95,6 @@ class ScenarioPropertiesValidator(
9695
.map(_ => ())
9796
}
9897

99-
private def getUnknownPropertyValidationResults(
100-
config: PropertyConfig,
101-
scenarioProperties: List[(String, String)]
102-
) = {
103-
scenarioProperties
104-
.map(property => (property._1, UnknownPropertyValidator(config)))
105-
.map { case (propertyName, validator) =>
106-
validator.isValid(propertyName).toValidatedNel
107-
}
108-
.sequence
109-
.map(_ => ())
110-
}
111-
11298
}
11399

114100
private final case class MissingRequiredPropertyValidator(actualPropertyNames: List[String]) {
@@ -124,15 +110,3 @@ private final case class MissingRequiredPropertyValidator(actualPropertyNames: L
124110
}
125111

126112
}
127-
128-
private final case class UnknownPropertyValidator(config: Map[String, ScenarioPropertyConfig]) {
129-
130-
def isValid(propertyName: String)(implicit nodeId: NodeId): Validated[PartSubGraphCompilationError, Unit] = {
131-
if (config.contains(propertyName)) {
132-
valid(())
133-
} else {
134-
invalid(UnknownProperty(ParameterName(propertyName)))
135-
}
136-
}
137-
138-
}

designer/server/src/test/scala/pl/touk/nussknacker/ui/api/ValidationResourcesSpec.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ class ValidationResourcesSpec
117117
val entity = entityAs[String]
118118
entity should include("Configured property requiredStringProperty (label) is missing")
119119
entity should include("Property numberOfThreads has invalid value")
120-
entity should include("Unknown property unknown")
121120
entity should include("This field value has to be an integer number")
122121
}
123122
}

designer/server/src/test/scala/pl/touk/nussknacker/ui/integration/BaseFlowTest.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ class BaseFlowTest
345345
validationResponse.code shouldEqual StatusCode.Ok
346346
validationResponse.body should include("Configured property environment (Environment) is missing")
347347
validationResponse.body should include("This field value has to be an integer number")
348-
validationResponse.body should include("Unknown property unknown")
349348
validationResponse.body should include("Property numberOfThreads (Number of threads) has invalid value") //
350349
}
351350

designer/server/src/test/scala/pl/touk/nussknacker/ui/validation/ScenarioPropertiesValidatorTest.scala

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -246,27 +246,4 @@ class ScenarioPropertiesValidatorTest extends AnyFunSuite with Matchers {
246246
}
247247
}
248248

249-
test("validate non empty config with unknown property") {
250-
val unknownProperty = "unknown"
251-
val result = validator.validate(
252-
Map(
253-
"propReq" -> "5",
254-
unknownProperty -> "some text"
255-
).toList
256-
)
257-
258-
result.errors.processPropertiesErrors should matchPattern {
259-
case List(
260-
NodeValidationError(
261-
"UnknownProperty",
262-
_,
263-
_,
264-
Some(`unknownProperty`),
265-
NodeValidationErrorType.SaveAllowed,
266-
None
267-
)
268-
) =>
269-
}
270-
}
271-
272249
}

designer/server/src/test/scala/pl/touk/nussknacker/ui/validation/UIProcessValidatorSpec.scala

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -624,34 +624,6 @@ class UIProcessValidatorSpec extends AnyFunSuite with Matchers with TableDrivenP
624624
validate(validScenarioGraphWithFields(Map("field2" -> "true"))) should not be withoutErrorsAndWarnings
625625
}
626626

627-
test("handle unknown properties validation") {
628-
val processValidator = ProcessTestData.testProcessValidator(
629-
scenarioProperties = Map(
630-
"field2" -> ScenarioPropertyConfig(
631-
defaultValue = None,
632-
editor = None,
633-
validators = Some(List(CompileTimeEvaluableValueValidator)),
634-
label = Some("label"),
635-
hintText = None
636-
)
637-
) ++ FlinkStreamingPropertiesConfig.properties
638-
)
639-
640-
val result =
641-
processValidator.validate(
642-
validScenarioGraphWithFields(Map("field1" -> "true")),
643-
ProcessTestData.sampleProcessName,
644-
isFragment = false,
645-
labels = List.empty,
646-
)
647-
648-
result.errors.processPropertiesErrors should matchPattern {
649-
case List(
650-
NodeValidationError("UnknownProperty", _, _, Some("field1"), NodeValidationErrorType.SaveAllowed, None)
651-
) =>
652-
}
653-
}
654-
655627
test("not allows save with incorrect characters in ids") {
656628
def process(nodeId: String) = createGraph(
657629
List(Source(nodeId, SourceRef(ProcessTestData.existingSourceFactory, List()))),

0 commit comments

Comments
 (0)