Copilot commented on code in PR #5640:
URL: https://github.com/apache/texera/pull/5640#discussion_r3404876738


##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/htmlviz/HtmlVizOpDesc.scala:
##########
@@ -30,14 +30,18 @@ import 
org.apache.texera.amber.operator.metadata.annotations.AutofillAttributeNa
 import org.apache.texera.amber.operator.metadata.{OperatorGroupConstants, 
OperatorInfo}
 import org.apache.texera.amber.util.JSONUtils.objectMapper
 
+import javax.validation.constraints.NotNull
+
 /**
   * HTML Visualization operator to render any given HTML code
   * This is the description of the operator
   */
 class HtmlVizOpDesc extends LogicalOp {
   @JsonProperty(required = true)
   @JsonSchemaTitle("HTML content")
-  @AutofillAttributeName var htmlContentAttrName: String = _
+  @AutofillAttributeName
+  @NotNull(message = "HTML content cannot be empty")
+  var htmlContentAttrName: String = _

Review Comment:
   `htmlContentAttrName` defaults to `null` (`_`), but `HtmlVizOpExec` 
dereferences it via `tuple.getField(..., desc.htmlContentAttrName)`. If the 
required property is omitted (e.g., direct API call), this will crash with a 
low-level exception before the new `@NotNull` message can help. Initialize to a 
non-null default and add an explicit assert so failures surface as a clear 
domain error.



##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/nestedTable/NestedTableOpDesc.scala:
##########
@@ -35,6 +36,7 @@ class NestedTableOpDesc extends PythonOperatorDescriptor {
     "List of columns to include in the nested table chart and their subgroup"
   )
   @JsonProperty(value = "add attribute", required = true)
+  @NotEmpty(message = "Included Columns cannot be empty")
   var includedColumns: util.List[NestedTableConfig] = _

Review Comment:
   `includedColumns` is declared as required/not-empty but still defaults to 
`null` (`_`). `createNestedTable()` immediately calls 
`includedColumns.asScala`, so a missing field will throw a 
`NullPointerException` (and an empty list will silently generate an invalid 
table) instead of surfacing the intended "Included Columns cannot be empty" 
message. Initialize the list and add an explicit assert before using it.



##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/visualization/continuousErrorBands/ContinuousErrorBandsOpDesc.scala:
##########
@@ -44,6 +45,7 @@ class ContinuousErrorBandsOpDesc extends 
PythonOperatorDescriptor {
   var yLabel: EncodableString = ""
 
   @JsonProperty(value = "bands", required = true)
+  @NotEmpty(message = "Bands cannot be empty")
   var bands: util.List[BandConfig] = _

Review Comment:
   `bands` is required/not-empty but still defaults to `null` (`_`). 
`createPlotlyFigure()` immediately calls `bands.asScala`, so a missing field 
will throw a `NullPointerException` instead of producing the intended 
validation message. Initialize `bands` and assert non-empty before iterating.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to