carloea2 commented on code in PR #9032:
URL: https://github.com/apache/texera/pull/9032#discussion_r4427186599


##########
.github/workflows/build.yml:
##########
@@ -330,7 +330,8 @@ jobs:
         run: |
           # Backport builds filter by the checked-out build.sbt.
           want=(DAO Auth Config Observability Resource Util PyBuilder 
WorkflowCore
-                WorkflowOperator WorkflowCompiler WorkflowExecutionService)
+                WorkflowOperator WorkflowCompiler WorkflowExecutionService
+                OperatorReferenceGenerator)

Review Comment:
   Generator-only changes currently receive `docs`, or `docs` and 
`dependencies`, which selects no build stack. I reproduced this with the actual 
precheck script on current main. Please add a label mapping for 
`docs/operator-reference` so its tests and lint run.



##########
docs/operator-reference/src/main/scala/org/apache/texera/operatorreference/JsonPropertyReflectionUtils.scala:
##########
@@ -0,0 +1,498 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.operatorreference
+
+import com.fasterxml.jackson.annotation.{
+  JsonCreator,
+  JsonIgnore,
+  JsonIgnoreProperties,
+  JsonProperty,
+  JsonPropertyDescription,
+  JsonValue
+}
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.kjetland.jackson.jsonSchema.annotations.{
+  JsonSchemaDescription,
+  JsonSchemaInject,
+  JsonSchemaTitle
+}
+import org.apache.texera.amber.core.workflow.OutputPort.OutputMode
+import org.apache.texera.amber.operator.LogicalOp
+import org.apache.texera.amber.operator.metadata.OperatorMetadataGenerator
+import org.apache.texera.amber.operator.machineLearning.sklearnAdvanced.base.{
+  HyperParameters,
+  ParamClass
+}
+import org.apache.texera.amber.operator.metadata.annotations.HideAnnotation
+
+import java.lang.annotation.Annotation
+import java.lang.reflect.{Field, Modifier, ParameterizedType}
+import javax.validation.constraints.{NotNull, Size}
+import scala.jdk.CollectionConverters._
+import scala.util.Try
+
+private[operatorreference] case class DocProperty(
+    displayName: String,
+    required: Boolean,
+    dataType: String,
+    defaultValue: String,
+    description: String,
+    children: List[DocProperty] = Nil,
+    codeTemplate: Option[String] = None
+)
+
+private[operatorreference] case class EnumParam(
+    name: String,
+    paramType: String,
+    defaultValue: String,
+    constraint: String
+)
+
+object JsonPropertyReflectionUtils {
+
+  private case class HideRule(target: String, hideType: String, expected: 
String)
+
+  // The section headings of the hand-written output-modes.md page.
+  private val OutputModeLabels: Map[OutputMode, String] = Map(
+    OutputMode.SET_SNAPSHOT -> "Set Snapshot",
+    OutputMode.SET_DELTA -> "Delta Updates",
+    OutputMode.SINGLE_SNAPSHOT -> "Single Snapshot"
+  )
+  private val HideEquals = HideAnnotation.Type.`equals`
+  private val HideRegex = HideAnnotation.Type.regex
+  private val mapper = new ObjectMapper()
+
+  def generatePropertiesTable(clazz: Class[_], rootPath: String): 
Option[String] = {
+    val properties = extractProperties(clazz, rootPath)
+    if (properties.isEmpty) return None
+
+    def escapeCell(s: String) = s.replace("\n", " ").replace("\r", " 
").replace("|", "\\|")
+    def renderRows(p: DocProperty, depth: Int): List[String] = {
+      val indent = if (depth == 0) "" else "  " * (depth - 1) + "↳ "
+      val requirement = if (p.required) "✓" else ""
+      val row =
+        s"| ${escapeCell(indent + p.displayName)} | $requirement | 
${escapeCell(p.dataType)} | " +
+          s"${escapeCell(p.defaultValue)} | ${wrap(escapeCell(p.description), 
50, " ")} |"
+      row :: p.children.flatMap(renderRows(_, depth + 1))
+    }
+    val table =
+      ("| Property | Requirement | Type | Default | Description |" ::
+        "|----------|-------------|------|---------|-------------|" :: 
properties.flatMap(
+        renderRows(_, 0)
+      ))
+        .mkString("\n")
+
+    val templates = properties.flatMap(p => p.codeTemplate.map(t => 
(p.displayName, t)))
+    if (templates.isEmpty) Some(table)
+    else {
+      val language = codeLanguage(clazz)
+      val sections = templates.map {
+        case (name, template) => s"**$name**\n\n```$language\n$template\n```"
+      }
+      Some(table + "\n\n#### Default Code Template\n\n" + 
sections.mkString("\n\n"))
+    }
+  }
+
+  def generateOutputSection(clazz: Class[_], rootPath: String): String = {
+    val ports = createInstance(clazz).collect { case op: LogicalOp => 
op.operatorInfo.outputPorts }
+    if (ports.isEmpty) return "*Output ports unavailable: the descriptor could 
not be instantiated*"
+    if (ports.get.isEmpty) return "*No output ports*"
+
+    val rows = ports.get.zipWithIndex.map {
+      case (port, idx) =>
+        val label = OutputModeLabels.getOrElse(port.mode, port.mode.name)
+        val anchor = label.toLowerCase.replace(' ', '-')
+        s"| $idx | [$label](${rootPath}output-modes/#$anchor) |"
+    }
+    ("### Output Ports\n\n| Port | Mode |\n|------|------|" :: 
rows).mkString("\n")
+  }
+
+  def getEnumClass(operatorClass: Class[_]): Option[Class[_]] =
+    operatorClass.getGenericSuperclass match {
+      case pt: ParameterizedType =>
+        pt.getActualTypeArguments.headOption.collect { case c: Class[_] if 
c.isEnum => c }
+      case _ => None
+    }
+
+  def extractEnumMetadata(enumClass: Class[_]): List[EnumParam] =
+    enumConstants(enumClass).collect {
+      case p: ParamClass =>
+        // getType is the Python converter the generated code applies to the 
chosen value.
+        val paramType = p.getType
+        val constraint =
+          if (p.getAllowedValues.nonEmpty) p.getAllowedValues.mkString(", ")
+          else if (p.getMinimum.nonEmpty) p.getMinimum
+          else "-"
+        EnumParam(
+          p.getName,
+          paramType,
+          Some(p.getSampleValue).filter(_.nonEmpty).getOrElse("-"),
+          constraint
+        )
+    }
+
+  private def extractProperties(clazz: Class[_], rootPath: String): 
List[DocProperty] = {
+    val instance = createInstance(clazz)
+    val fields = documentableFields(clazz)
+    val byJsonName = fields.map(f => jsonName(f) -> f).toMap
+
+    def toggleParent(field: Field): Option[Field] =
+      fields
+        .find(t => toggledFields(t).exists(n => n == field.getName || n == 
jsonName(field)))
+        .orElse {
+          hideRule(field).collect {
+            case HideRule(target, HideEquals, _) =>
+              byJsonName.get(target).filter { t =>
+                Set[Class[_]](classOf[Boolean], classOf[java.lang.Boolean])
+                  .exists(b => t.getType == b || contentAs(t).contains(b))
+              }
+          }.flatten
+        }
+
+    def toProperty(field: Field): DocProperty = {
+      val (dataType, children) = dataTypeAndChildren(field, clazz, rootPath)
+      val template = codeTemplate(field)
+      val hideNote = hideRule(field).map {
+        case HideRule(target, HideRegex, expected) =>
+          s"Hidden when ${targetLabel(target, byJsonName)} matches `$expected`"
+        case HideRule(target, _, expected) =>
+          s"Hidden when ${targetLabel(target, byJsonName)} is `$expected`"
+      }
+      DocProperty(
+        displayName(field),
+        isRequired(field),
+        dataType,
+        if (template.isDefined) "`See template below`" else 
defaultValue(field, instance),
+        (description(field, clazz) ++ hideNote)
+          .reduceOption((a, b) => if (a.endsWith(".") || a.endsWith(")")) s"$a 
$b" else s"$a. $b")
+          .getOrElse(""),
+        children,
+        template
+      )
+    }
+
+    fields.filter(f => toggleParent(f).isEmpty).map { field =>
+      val property = toProperty(field)
+      val toggled = fields.filter(g => 
toggleParent(g).contains(field)).map(toProperty)
+      property.copy(children = property.children ++ toggled)
+    }
+  }
+
+  private def targetLabel(target: String, byJsonName: Map[String, Field]): 
String =
+    s"`${byJsonName.get(target).map(displayName).getOrElse(target)}`"
+
+  private def documentableFields(clazz: Class[_]): List[Field] = {
+    val schemaOrder = schemaPropertyOrder(clazz)
+    val chain = Iterator
+      .iterate[Class[_]](clazz)(_.getSuperclass)
+      .takeWhile(c => c != null && c != classOf[Object] && c != 
classOf[LogicalOp])
+      .toList
+      .reverse
+    val ignored = chain
+      .flatMap(c => Option(c.getAnnotation(classOf[JsonIgnoreProperties])))
+      .flatMap(_.value())
+      .toSet
+    chain
+      .flatMap(_.getDeclaredFields)
+      .filterNot(f => f.isSynthetic || Modifier.isStatic(f.getModifiers) || 
f.getName.contains("$"))
+      .filterNot(f =>
+        ignored.contains(f.getName) || findAnnotation(f, 
classOf[JsonIgnore]).isDefined
+      )
+      .filter { f =>
+        findAnnotation(f, classOf[JsonProperty]).isDefined ||
+        findAnnotation(f, classOf[JsonSchemaTitle]).isDefined ||
+        findAnnotation(f, classOf[JsonPropertyDescription]).isDefined ||
+        findAnnotation(f, classOf[JsonSchemaDescription]).isDefined
+      }
+      .groupBy(_.getName)
+      .values
+      .map(_.last)
+      .toList
+      .sortBy(f => schemaOrder.indexOf(jsonName(f)))
+  }
+
+  // The property panel lists properties in the JSON schema's order, so the 
pages do too.
+  private def schemaPropertyOrder(clazz: Class[_]): List[String] =
+    
Try(OperatorMetadataGenerator.jsonSchemaGenerator.generateJsonSchema(clazz)).toOption
+      .map(_.path("properties").fieldNames().asScala.toList)
+      .getOrElse(Nil)
+
+  private def jsonName(field: Field): String =
+    findAnnotation(field, classOf[JsonProperty])
+      .map(_.value())
+      .filter(_.nonEmpty)
+      .getOrElse(field.getName)
+
+  private def displayName(field: Field): String =
+    findAnnotation(field, classOf[JsonSchemaTitle])
+      .map(_.value())
+      .filter(_.nonEmpty)
+      .getOrElse(toTitleCase(jsonName(field)))
+
+  private def isRequired(field: Field): Boolean =
+    findAnnotation(field, classOf[JsonProperty]).exists(_.required()) ||
+      findAnnotation(field, classOf[NotNull]).isDefined
+
+  private def defaultValue(field: Field, instance: Option[AnyRef]): String =
+    findAnnotation(field, classOf[JsonProperty])
+      .map(_.defaultValue())
+      .filter(v => v.nonEmpty && v != "\u0000")
+      .orElse(instance.flatMap { inst =>
+        field.setAccessible(true)
+        Try(field.get(inst)).toOption.flatMap(formatDefault)
+      })
+      .getOrElse("-")
+
+  private def formatDefault(value: Any): Option[String] =
+    value match {
+      case null | None | "" | Nil                    => None
+      case Some(inner)                               => formatDefault(inner)
+      case xs: scala.collection.Iterable[_]          => Some(s"[${xs.size} 
items]")
+      case xs: java.util.Collection[_] if xs.isEmpty => None
+      case xs: java.util.Collection[_]               => Some(s"[${xs.size} 
items]")
+      case other                                     => Some(other.toString)
+    }
+
+  private def description(field: Field, owner: Class[_]): Option[String] = {
+    val base = getterAnnotation(field, classOf[JsonPropertyDescription], owner)
+      .orElse(findAnnotation(field, classOf[JsonPropertyDescription]))
+      .map(_.value())
+      .orElse(findAnnotation(field, 
classOf[JsonSchemaDescription]).map(_.value()))
+      .filter(_.nonEmpty)
+      .map(s => s"${s.head.toUpper}${s.tail}".stripSuffix("."))
+    val constraints = findAnnotation(field, classOf[Size]).toList.flatMap { 
size =>
+      Option(size.min()).filter(_ > 0).map(m => s"min: $m") ++
+        Option(size.max()).filter(_ < Int.MaxValue).map(m => s"max: $m") ++
+        Option(size.message()).filter(m => m.nonEmpty && !m.startsWith("{"))
+    }
+    (base, constraints) match {
+      case (Some(b), Nil) => Some(b)
+      case (Some(b), cs)  => Some(s"$b (${cs.mkString(", ")})")
+      case (None, Nil)    => None
+      case (None, cs)     => Some(cs.mkString(", "))
+    }
+  }
+
+  private def hideRule(field: Field): Option[HideRule] =
+    findAnnotation(field, classOf[JsonSchemaInject]).flatMap { inject =>
+      val strings = inject.strings().map(s => s.path() -> s.value()).toMap
+      for {
+        target <- strings.get(HideAnnotation.hideTarget)
+        hideType <- strings.get(HideAnnotation.hideType)
+        expected <- strings.get(HideAnnotation.hideExpectedValue)
+      } yield HideRule(target, hideType, expected)
+    }
+
+  private def toggledFields(field: Field): List[String] =
+    findAnnotation(field, classOf[JsonSchemaInject]).toList.flatMap { inject =>
+      Try(mapper.readTree(inject.json()).get("toggleHidden")).toOption
+        .filter(_ != null)
+        .toList
+        .flatMap(_.asScala.map(_.asText()))
+    }
+
+  // Erasure hides the element type of Option/List fields; descriptors name it 
with contentAs.
+  private def contentAs(field: Field): Option[Class[_]] =
+    findAnnotation(field, classOf[JsonDeserialize])
+      .map(_.contentAs())
+      .filter(c => c != classOf[Void] && c != classOf[Object])
+
+  // The frontend opens the code editor for exactly this description.
+  private def codeTemplate(field: Field): Option[String] =
+    findAnnotation(field, classOf[JsonPropertyDescription])
+      .filter(_.value().equalsIgnoreCase("Input your code here"))
+      .flatMap(_ => findAnnotation(field, classOf[JsonProperty]))
+      .map(_.defaultValue())
+      .filter(_.nonEmpty)
+
+  // Mirrors the frontend's CodeEditorComponent, which picks the language by 
operator type.
+  private def codeLanguage(clazz: Class[_]): String = {
+    val name = clazz.getSimpleName
+    if (name.contains("Python")) "python" else if (name.startsWith("RUDF")) 
"r" else "java"
+  }
+
+  private def dataTypeAndChildren(
+      field: Field,
+      owner: Class[_],
+      rootPath: String
+  ): (String, List[DocProperty]) = {
+    if (codeTemplate(field).isDefined) return (s"Code 
(${codeLanguage(owner)})", Nil)
+    val accepted = attributeTypeRules(owner).getOrElse(jsonName(field), Nil)
+    val (dataType, children) = plainTypeAndChildren(field, owner, rootPath)

Review Comment:
   Please include enum choices supplied by `JsonSchemaInject`. ECDF's Y Axis 
Mode allows `probability`, `count` and `sum`, but the generated type is just 
`String`. I reproduced this for six dropdowns across ECDF, Histogram and Time 
Series. Please add coverage alongside the Java enum case.



##########
docs/operator-reference/src/main/scala/org/apache/texera/operatorreference/OperatorDocScanner.scala:
##########
@@ -0,0 +1,339 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.operatorreference
+
+import org.apache.texera.amber.operator.metadata.{
+  GroupInfo,
+  OperatorMetadata,
+  OperatorMetadataGenerator
+}
+
+import java.nio.charset.StandardCharsets
+import java.nio.file.{Files, Path, Paths}
+import scala.jdk.CollectionConverters._
+
+/**
+  * Regenerates the operator reference pages from the descriptors on the 
classpath. Run it from
+  * the repository root, where the default output directory resolves:
+  *
+  *   sbt "OperatorReferenceGenerator/runMain 
org.apache.texera.operatorreference.OperatorDocScanner [outputDir]"
+  *
+  * Every markdown file under the output directory is replaced, except the 
hand-written
+  * `output-modes.md`.
+  */
+object OperatorDocScanner {
+
+  private val DefaultOutputDir = "docs/reference/operators"
+  private val HandWrittenPages = Set("output-modes.md")
+  // Placeholder operator the frontend never lists; it gets no renderPage.
+  private val HiddenOperatorTypes = Set("Dummy")
+
+  private val LicenseHeader =
+    """<!--
+      |  ~ Licensed to the Apache Software Foundation (ASF) under one
+      |  ~ or more contributor license agreements.  See the NOTICE file
+      |  ~ distributed with this work for additional information
+      |  ~ regarding copyright ownership.  The ASF licenses this file
+      |  ~ to you under the Apache License, Version 2.0 (the
+      |  ~ "License"); you may not use this file except in compliance
+      |  ~ with the License.  You may obtain a copy of the License at
+      |  ~
+      |  ~   http://www.apache.org/licenses/LICENSE-2.0
+      |  ~
+      |  ~ Unless required by applicable law or agreed to in writing,
+      |  ~ software distributed under the License is distributed on an
+      |  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |  ~ KIND, either express or implied.  See the License for the
+      |  ~ specific language governing permissions and limitations
+      |  ~ under the License.
+      |-->
+      |
+      |""".stripMargin
+
+  private case class ParameterSet(enumClass: Class[_], operators: 
List[OperatorMetadata])
+
+  private lazy val operatorClasses: Map[String, Class[_]] =
+    OperatorMetadataGenerator.operatorTypeMap.map { case (clazz, name) => name 
-> clazz }
+
+  private lazy val groupPaths: Map[String, String] = {
+    def walk(groups: List[GroupInfo], prefix: String): Map[String, String] =
+      groups.flatMap { g =>
+        val path = if (prefix.isEmpty) toSlug(g.groupName) else 
s"$prefix/${toSlug(g.groupName)}"
+        Map(g.groupName -> path) ++ walk(childGroups(g), path)
+      }.toMap
+    walk(OperatorMetadataGenerator.allOperatorMetadata.groups, "")
+  }
+
+  def main(args: Array[String]): Unit = {
+    val outputDir = Paths.get(args.headOption.getOrElse(DefaultOutputDir))
+    val metadata = OperatorMetadataGenerator.allOperatorMetadata
+    val operators =
+      metadata.operators.filterNot(op => 
HiddenOperatorTypes.contains(op.operatorType))
+    val byGroup = operators.groupBy(op => 
groupPath(op.additionalMetadata.operatorGroupName))
+
+    deleteGeneratedPages(outputDir)
+
+    operators.foreach { op =>
+      val dir = groupPath(op.additionalMetadata.operatorGroupName)
+      writeFile(outputDir.resolve(dir).resolve(s"${operatorSlug(op)}.md"), 
operatorPage(op, dir))
+    }
+    metadata.groups.zipWithIndex.foreach {
+      case (group, i) => writeGroupIndexes(outputDir, group, Nil, i + 1, 
byGroup)
+    }
+
+    val parameterSets = operators
+      .flatMap(op =>
+        
JsonPropertyReflectionUtils.getEnumClass(operatorClasses(op.operatorType)).map(_
 -> op)
+      )
+      .groupBy(_._1)
+      .map { case (enumClass, pairs) => ParameterSet(enumClass, 
pairs.map(_._2)) }
+      .toList
+      .sortBy(_.enumClass.getSimpleName)
+    parameterSets.foreach { set =>
+      val file = 
s"${JsonPropertyReflectionUtils.parameterPageSlug(set.enumClass)}.md"
+      writeFile(outputDir.resolve("parameters").resolve(file), 
parameterPage(set))
+    }
+    writeFile(outputDir.resolve("parameters/_index.md"), 
parameterIndex(parameterSets))
+    writeFile(outputDir.resolve("_index.md"), rootIndex(metadata.groups, 
byGroup))
+
+    println(
+      s"Wrote ${operators.size} operator pages, ${groupPaths.size} group 
indexes and " +
+        s"${parameterSets.size} parameter pages to $outputDir"
+    )
+  }
+
+  private def operatorPage(op: OperatorMetadata, dir: String): String = {
+    val info = op.additionalMetadata
+    val depth = dir.count(_ == '/') + 1
+    val rootPath = "../" * (depth + 1)
+    val operatorClass = operatorClasses(op.operatorType)
+
+    val frontMatter = List(
+      Some(s"""title: "${escapeYamlString(info.userFriendlyName)}""""),
+      Option(info.operatorDescription)
+        .filter(_.nonEmpty)
+        .map(d => s"""description: "${escapeYamlString(toSingleLine(d))}""""),
+      Some(s"""category: "${escapeYamlString(info.operatorGroupName)}""""),
+      Some(s"""operator_type: "${escapeYamlString(op.operatorType)}""""),
+      Some(s"tags: [${dir.replace("/", ", ")}]")
+    ).flatten
+
+    val ancestors = groupAncestry(info.operatorGroupName)
+    val breadcrumb = (s"[Home]($rootPath)" :: ancestors.zipWithIndex.map {
+      case (name, i) => s"[$name](${"../" * (ancestors.size - i)})"
+    }).mkString(" > ")
+
+    val properties = JsonPropertyReflectionUtils
+      .generatePropertiesTable(operatorClass, rootPath)
+      .map(table => s"### Input Properties\n\n$table")
+    val outputs = 
JsonPropertyReflectionUtils.generateOutputSection(operatorClass, rootPath)
+
+    renderPage(frontMatter, breadcrumb :: properties.toList ::: List(outputs))
+  }
+
+  private def writeGroupIndexes(
+      outputDir: Path,
+      group: GroupInfo,
+      ancestors: List[String],
+      weight: Int,
+      byGroup: Map[String, List[OperatorMetadata]]
+  ): Unit = {
+    val dir = groupPath(group.groupName)
+    val depth = ancestors.size + 1
+    val frontMatter = List(
+      s"""title: "${escapeYamlString(group.groupName)}"""",
+      s"""description: "Operators in the ${escapeYamlString(group.groupName)} 
category"""",
+      s"weight: $weight",
+      "categories: [Operators]",
+      s"tags: [${dir.replace("/", ", ")}]"
+    )
+    val breadcrumb = (s"[Home](${"../" * depth})" :: 
ancestors.zipWithIndex.map {
+      case (name, i) => s"[$name](${"../" * (ancestors.size - i)})"
+    } ::: List(group.groupName)).mkString(" > ")
+
+    val subcategories = Some(childGroups(group)).filter(_.nonEmpty).map { subs 
=>
+      "## Subcategories\n\n" + subs
+        .map(c => s"- [${c.groupName}](${toSlug(c.groupName)}/)")
+        .mkString("\n")
+    }
+    val operators = byGroup.get(dir).map { ops =>
+      val rows = ops.sortBy(_.additionalMetadata.userFriendlyName).map { op =>
+        val description = Option(op.additionalMetadata.operatorDescription)
+          .filter(_.nonEmpty)
+          .map(toSingleLine)
+          .getOrElse("-")
+        s"| [${op.additionalMetadata.userFriendlyName}](${operatorSlug(op)}/) 
| $description |"
+      }
+      "## Operators\n\n| Operator | Description 
|\n|----------|-------------|\n" +
+        rows.mkString("\n") + s"\n\n**Total**: ${operatorCount(ops.size)}"
+    }
+
+    writeFile(
+      outputDir.resolve(dir).resolve("_index.md"),
+      renderPage(frontMatter, breadcrumb :: subcategories.toList ::: 
operators.toList)
+    )
+    childGroups(group).zipWithIndex.foreach {
+      case (child, i) =>
+        writeGroupIndexes(outputDir, child, ancestors :+ group.groupName, i + 
1, byGroup)
+    }
+  }
+
+  private def rootIndex(
+      groups: List[GroupInfo],
+      byGroup: Map[String, List[OperatorMetadata]]
+  ): String = {
+    def total(group: GroupInfo): Int = {
+      val own = 
byGroup.get(groupPath(group.groupName)).map(_.size).getOrElse(0)
+      own + childGroups(group).map(total).sum
+    }
+    def section(group: GroupInfo, level: Int): List[String] = {
+      val operators =
+        Some(total(group)).filter(_ > 0).map(n => s" 
(${operatorCount(n)})").getOrElse("")
+      s"${"  " * level}- 
[${group.groupName}](${groupPath(group.groupName)}/)$operators" ::
+        childGroups(group).flatMap(section(_, level + 1))
+    }
+    val frontMatter = List(
+      """title: "Operators"""",
+      """description: "Complete reference for all Texera operators organized 
by category"""",
+      "weight: 1",
+      "categories: [Documentation]",
+      "tags: [operators, reference, index]"
+    )
+    renderPage(
+      frontMatter,
+      List(
+        "## Quick Links\n\n" +
+          "- [Output Port Modes](output-modes/) - how each output port 
delivers its results\n" +
+          "- [Parameter Reference](parameters/) - ML parameter specifications",
+        "---",
+        "## Operator Categories\n\n" + groups.flatMap(section(_, 
0)).mkString("\n")
+      )
+    )
+  }
+
+  private def parameterPage(set: ParameterSet): String = {
+    val name = set.enumClass.getSimpleName.stripSuffix("Parameters")
+    val frontMatter = List(
+      s"""title: "${escapeYamlString(name)} Parameters"""",
+      s"""description: "Hyperparameters accepted by 
${escapeYamlString(name)}"""",
+      "categories: [Parameters]",
+      "tags: [ml, sklearn, parameters]"
+    )
+    val usedBy = 
set.operators.sortBy(_.additionalMetadata.userFriendlyName).map { op =>
+      val dir = groupPath(op.additionalMetadata.operatorGroupName)
+      s"- 
[${op.additionalMetadata.userFriendlyName}](../../$dir/${operatorSlug(op)}/)"
+    }
+    val rows = JsonPropertyReflectionUtils
+      .extractEnumMetadata(set.enumClass)
+      .map(p => s"| ${p.name} | `${p.paramType}` | ${p.defaultValue} | 
${p.constraint} |")
+    renderPage(
+      frontMatter,
+      List(
+        "[← Parameters Index](../)",
+        "## Used By\n\nThis parameter set is used by the following 
operators:\n\n" + usedBy
+          .mkString("\n"),
+        "## Parameters\n\n| Parameter | Type | Default | Allowed values |\n" +
+          "|-----------|------|---------|----------------|\n" + 
rows.mkString("\n")
+      )
+    )
+  }
+
+  private def parameterIndex(sets: List[ParameterSet]): String = {
+    val frontMatter = List(
+      """title: "Parameter Reference"""",
+      """description: "Complete reference for machine learning operator 
parameters"""",
+      "weight: 13",
+      "categories: [Reference]",
+      "tags: [parameters, ml, reference]"
+    )
+    val rows = sets.map { set =>
+      val name = set.enumClass.getSimpleName.stripSuffix("Parameters")
+      val operators = 
set.operators.map(_.additionalMetadata.userFriendlyName).sorted
+      s"| 
[$name](${JsonPropertyReflectionUtils.parameterPageSlug(set.enumClass)}/) | " +
+        s"${operators.size} | ${operators.mkString(", ")} |"
+    }
+    renderPage(
+      frontMatter,
+      List(
+        "[← Home](../)",
+        "## Available Parameter Sets\n\n| Parameter Set | Used By | Operators 
|\n" +
+          "|---------------|---------|----------|\n" + rows.mkString("\n")
+      )
+    )
+  }
+
+  private def renderPage(frontMatter: List[String], sections: List[String]): 
String = {
+    val header = LicenseHeader + "---\n" + frontMatter.mkString("\n") + 
"\n---\n\n"
+    header + sections.mkString("\n\n") + "\n"
+  }
+
+  // Descriptions land in YAML front matter and table cells, so they must be 
one line.
+  private def toSingleLine(s: String): String = {
+    val joined = s.trim.replaceAll("\\s*\\n\\s*", " ")
+    s"${joined.head.toUpper}${joined.tail}"
+  }
+
+  private def groupPath(groupName: String): String =
+    groupPaths.getOrElse(
+      groupName,
+      throw new NoSuchElementException(
+        s"operator group '$groupName' is not in 
OperatorGroupConstants.OperatorGroupOrderList"
+      )
+    )
+
+  private def childGroups(group: GroupInfo): List[GroupInfo] = 
Option(group.children).getOrElse(Nil)
+
+  private def groupAncestry(groupName: String): List[String] = {
+    def find(groups: List[GroupInfo], path: List[String]): 
Option[List[String]] =
+      groups.view.flatMap { g =>
+        if (g.groupName == groupName) Some(path :+ g.groupName)
+        else find(childGroups(g), path :+ g.groupName)
+      }.headOption
+    find(OperatorMetadataGenerator.allOperatorMetadata.groups, Nil).get
+  }
+
+  private def operatorCount(n: Int): String = if (n == 1) "1 operator" else 
s"$n operators"
+
+  private def operatorSlug(op: OperatorMetadata): String =
+    toSlug(op.additionalMetadata.userFriendlyName)
+
+  private def toSlug(name: String): String =
+    name.trim.replaceAll("\\s+", "-").replaceAll("[^a-zA-Z0-9-]", 
"").toLowerCase

Review Comment:
   Nonblocking: please use `Locale.ROOT` when lowercasing slugs. A Turkish JVM 
locale changes 20 existing paths by converting uppercase I to a dotless i, 
including the paths for Data Input, Interval Join and If. English repeat runs 
were identical. A locale test would keep reference URLs stable.



##########
docs/operator-reference/src/main/scala/org/apache/texera/operatorreference/JsonPropertyReflectionUtils.scala:
##########
@@ -0,0 +1,498 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.operatorreference
+
+import com.fasterxml.jackson.annotation.{
+  JsonCreator,
+  JsonIgnore,
+  JsonIgnoreProperties,
+  JsonProperty,
+  JsonPropertyDescription,
+  JsonValue
+}
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.kjetland.jackson.jsonSchema.annotations.{
+  JsonSchemaDescription,
+  JsonSchemaInject,
+  JsonSchemaTitle
+}
+import org.apache.texera.amber.core.workflow.OutputPort.OutputMode
+import org.apache.texera.amber.operator.LogicalOp
+import org.apache.texera.amber.operator.metadata.OperatorMetadataGenerator
+import org.apache.texera.amber.operator.machineLearning.sklearnAdvanced.base.{
+  HyperParameters,
+  ParamClass
+}
+import org.apache.texera.amber.operator.metadata.annotations.HideAnnotation
+
+import java.lang.annotation.Annotation
+import java.lang.reflect.{Field, Modifier, ParameterizedType}
+import javax.validation.constraints.{NotNull, Size}
+import scala.jdk.CollectionConverters._
+import scala.util.Try
+
+private[operatorreference] case class DocProperty(
+    displayName: String,
+    required: Boolean,
+    dataType: String,
+    defaultValue: String,
+    description: String,
+    children: List[DocProperty] = Nil,
+    codeTemplate: Option[String] = None
+)
+
+private[operatorreference] case class EnumParam(
+    name: String,
+    paramType: String,
+    defaultValue: String,
+    constraint: String
+)
+
+object JsonPropertyReflectionUtils {
+
+  private case class HideRule(target: String, hideType: String, expected: 
String)
+
+  // The section headings of the hand-written output-modes.md page.
+  private val OutputModeLabels: Map[OutputMode, String] = Map(
+    OutputMode.SET_SNAPSHOT -> "Set Snapshot",
+    OutputMode.SET_DELTA -> "Delta Updates",
+    OutputMode.SINGLE_SNAPSHOT -> "Single Snapshot"
+  )
+  private val HideEquals = HideAnnotation.Type.`equals`
+  private val HideRegex = HideAnnotation.Type.regex
+  private val mapper = new ObjectMapper()
+
+  def generatePropertiesTable(clazz: Class[_], rootPath: String): 
Option[String] = {
+    val properties = extractProperties(clazz, rootPath)
+    if (properties.isEmpty) return None
+
+    def escapeCell(s: String) = s.replace("\n", " ").replace("\r", " 
").replace("|", "\\|")
+    def renderRows(p: DocProperty, depth: Int): List[String] = {
+      val indent = if (depth == 0) "" else "&nbsp;&nbsp;" * (depth - 1) + "↳ "
+      val requirement = if (p.required) "✓" else ""
+      val row =
+        s"| ${escapeCell(indent + p.displayName)} | $requirement | 
${escapeCell(p.dataType)} | " +

Review Comment:
   Please escape or code-format collection types. With the website's Hugo 
settings, `List<Filter Predicate>` renders as just `List`. I reproduced this in 
90 type cells across 84 generated pages. A rendered-output regression test 
would catch it.



##########
docs/operator-reference/src/main/scala/org/apache/texera/operatorreference/JsonPropertyReflectionUtils.scala:
##########
@@ -0,0 +1,498 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.operatorreference
+
+import com.fasterxml.jackson.annotation.{
+  JsonCreator,
+  JsonIgnore,
+  JsonIgnoreProperties,
+  JsonProperty,
+  JsonPropertyDescription,
+  JsonValue
+}
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.kjetland.jackson.jsonSchema.annotations.{
+  JsonSchemaDescription,
+  JsonSchemaInject,
+  JsonSchemaTitle
+}
+import org.apache.texera.amber.core.workflow.OutputPort.OutputMode
+import org.apache.texera.amber.operator.LogicalOp
+import org.apache.texera.amber.operator.metadata.OperatorMetadataGenerator
+import org.apache.texera.amber.operator.machineLearning.sklearnAdvanced.base.{
+  HyperParameters,
+  ParamClass
+}
+import org.apache.texera.amber.operator.metadata.annotations.HideAnnotation
+
+import java.lang.annotation.Annotation
+import java.lang.reflect.{Field, Modifier, ParameterizedType}
+import javax.validation.constraints.{NotNull, Size}
+import scala.jdk.CollectionConverters._
+import scala.util.Try
+
+private[operatorreference] case class DocProperty(
+    displayName: String,
+    required: Boolean,
+    dataType: String,
+    defaultValue: String,
+    description: String,
+    children: List[DocProperty] = Nil,
+    codeTemplate: Option[String] = None
+)
+
+private[operatorreference] case class EnumParam(
+    name: String,
+    paramType: String,
+    defaultValue: String,
+    constraint: String
+)
+
+object JsonPropertyReflectionUtils {
+
+  private case class HideRule(target: String, hideType: String, expected: 
String)
+
+  // The section headings of the hand-written output-modes.md page.
+  private val OutputModeLabels: Map[OutputMode, String] = Map(
+    OutputMode.SET_SNAPSHOT -> "Set Snapshot",
+    OutputMode.SET_DELTA -> "Delta Updates",
+    OutputMode.SINGLE_SNAPSHOT -> "Single Snapshot"
+  )
+  private val HideEquals = HideAnnotation.Type.`equals`
+  private val HideRegex = HideAnnotation.Type.regex
+  private val mapper = new ObjectMapper()
+
+  def generatePropertiesTable(clazz: Class[_], rootPath: String): 
Option[String] = {
+    val properties = extractProperties(clazz, rootPath)
+    if (properties.isEmpty) return None
+
+    def escapeCell(s: String) = s.replace("\n", " ").replace("\r", " 
").replace("|", "\\|")
+    def renderRows(p: DocProperty, depth: Int): List[String] = {
+      val indent = if (depth == 0) "" else "&nbsp;&nbsp;" * (depth - 1) + "↳ "
+      val requirement = if (p.required) "✓" else ""
+      val row =
+        s"| ${escapeCell(indent + p.displayName)} | $requirement | 
${escapeCell(p.dataType)} | " +
+          s"${escapeCell(p.defaultValue)} | ${wrap(escapeCell(p.description), 
50, " ")} |"
+      row :: p.children.flatMap(renderRows(_, depth + 1))
+    }
+    val table =
+      ("| Property | Requirement | Type | Default | Description |" ::
+        "|----------|-------------|------|---------|-------------|" :: 
properties.flatMap(
+        renderRows(_, 0)
+      ))
+        .mkString("\n")
+
+    val templates = properties.flatMap(p => p.codeTemplate.map(t => 
(p.displayName, t)))
+    if (templates.isEmpty) Some(table)
+    else {
+      val language = codeLanguage(clazz)
+      val sections = templates.map {
+        case (name, template) => s"**$name**\n\n```$language\n$template\n```"
+      }
+      Some(table + "\n\n#### Default Code Template\n\n" + 
sections.mkString("\n\n"))
+    }
+  }
+
+  def generateOutputSection(clazz: Class[_], rootPath: String): String = {
+    val ports = createInstance(clazz).collect { case op: LogicalOp => 
op.operatorInfo.outputPorts }
+    if (ports.isEmpty) return "*Output ports unavailable: the descriptor could 
not be instantiated*"
+    if (ports.get.isEmpty) return "*No output ports*"
+
+    val rows = ports.get.zipWithIndex.map {
+      case (port, idx) =>
+        val label = OutputModeLabels.getOrElse(port.mode, port.mode.name)
+        val anchor = label.toLowerCase.replace(' ', '-')
+        s"| $idx | [$label](${rootPath}output-modes/#$anchor) |"
+    }
+    ("### Output Ports\n\n| Port | Mode |\n|------|------|" :: 
rows).mkString("\n")
+  }
+
+  def getEnumClass(operatorClass: Class[_]): Option[Class[_]] =
+    operatorClass.getGenericSuperclass match {
+      case pt: ParameterizedType =>
+        pt.getActualTypeArguments.headOption.collect { case c: Class[_] if 
c.isEnum => c }
+      case _ => None
+    }
+
+  def extractEnumMetadata(enumClass: Class[_]): List[EnumParam] =
+    enumConstants(enumClass).collect {
+      case p: ParamClass =>
+        // getType is the Python converter the generated code applies to the 
chosen value.
+        val paramType = p.getType
+        val constraint =
+          if (p.getAllowedValues.nonEmpty) p.getAllowedValues.mkString(", ")
+          else if (p.getMinimum.nonEmpty) p.getMinimum
+          else "-"
+        EnumParam(
+          p.getName,
+          paramType,
+          Some(p.getSampleValue).filter(_.nonEmpty).getOrElse("-"),
+          constraint
+        )
+    }
+
+  private def extractProperties(clazz: Class[_], rootPath: String): 
List[DocProperty] = {
+    val instance = createInstance(clazz)
+    val fields = documentableFields(clazz)
+    val byJsonName = fields.map(f => jsonName(f) -> f).toMap
+
+    def toggleParent(field: Field): Option[Field] =
+      fields
+        .find(t => toggledFields(t).exists(n => n == field.getName || n == 
jsonName(field)))
+        .orElse {
+          hideRule(field).collect {
+            case HideRule(target, HideEquals, _) =>
+              byJsonName.get(target).filter { t =>
+                Set[Class[_]](classOf[Boolean], classOf[java.lang.Boolean])
+                  .exists(b => t.getType == b || contentAs(t).contains(b))
+              }
+          }.flatten
+        }
+
+    def toProperty(field: Field): DocProperty = {
+      val (dataType, children) = dataTypeAndChildren(field, clazz, rootPath)
+      val template = codeTemplate(field)
+      val hideNote = hideRule(field).map {
+        case HideRule(target, HideRegex, expected) =>
+          s"Hidden when ${targetLabel(target, byJsonName)} matches `$expected`"
+        case HideRule(target, _, expected) =>
+          s"Hidden when ${targetLabel(target, byJsonName)} is `$expected`"
+      }
+      DocProperty(
+        displayName(field),
+        isRequired(field),
+        dataType,
+        if (template.isDefined) "`See template below`" else 
defaultValue(field, instance),
+        (description(field, clazz) ++ hideNote)
+          .reduceOption((a, b) => if (a.endsWith(".") || a.endsWith(")")) s"$a 
$b" else s"$a. $b")
+          .getOrElse(""),
+        children,
+        template
+      )
+    }
+
+    fields.filter(f => toggleParent(f).isEmpty).map { field =>
+      val property = toProperty(field)
+      val toggled = fields.filter(g => 
toggleParent(g).contains(field)).map(toProperty)
+      property.copy(children = property.children ++ toggled)
+    }
+  }
+
+  private def targetLabel(target: String, byJsonName: Map[String, Field]): 
String =
+    s"`${byJsonName.get(target).map(displayName).getOrElse(target)}`"
+
+  private def documentableFields(clazz: Class[_]): List[Field] = {
+    val schemaOrder = schemaPropertyOrder(clazz)
+    val chain = Iterator
+      .iterate[Class[_]](clazz)(_.getSuperclass)
+      .takeWhile(c => c != null && c != classOf[Object] && c != 
classOf[LogicalOp])
+      .toList
+      .reverse
+    val ignored = chain
+      .flatMap(c => Option(c.getAnnotation(classOf[JsonIgnoreProperties])))
+      .flatMap(_.value())
+      .toSet
+    chain
+      .flatMap(_.getDeclaredFields)
+      .filterNot(f => f.isSynthetic || Modifier.isStatic(f.getModifiers) || 
f.getName.contains("$"))
+      .filterNot(f =>
+        ignored.contains(f.getName) || findAnnotation(f, 
classOf[JsonIgnore]).isDefined
+      )
+      .filter { f =>
+        findAnnotation(f, classOf[JsonProperty]).isDefined ||
+        findAnnotation(f, classOf[JsonSchemaTitle]).isDefined ||
+        findAnnotation(f, classOf[JsonPropertyDescription]).isDefined ||
+        findAnnotation(f, classOf[JsonSchemaDescription]).isDefined
+      }
+      .groupBy(_.getName)
+      .values
+      .map(_.last)
+      .toList
+      .sortBy(f => schemaOrder.indexOf(jsonName(f)))
+  }
+
+  // The property panel lists properties in the JSON schema's order, so the 
pages do too.
+  private def schemaPropertyOrder(clazz: Class[_]): List[String] =
+    
Try(OperatorMetadataGenerator.jsonSchemaGenerator.generateJsonSchema(clazz)).toOption
+      .map(_.path("properties").fieldNames().asScala.toList)
+      .getOrElse(Nil)
+
+  private def jsonName(field: Field): String =
+    findAnnotation(field, classOf[JsonProperty])
+      .map(_.value())
+      .filter(_.nonEmpty)
+      .getOrElse(field.getName)
+
+  private def displayName(field: Field): String =
+    findAnnotation(field, classOf[JsonSchemaTitle])
+      .map(_.value())
+      .filter(_.nonEmpty)
+      .getOrElse(toTitleCase(jsonName(field)))
+
+  private def isRequired(field: Field): Boolean =
+    findAnnotation(field, classOf[JsonProperty]).exists(_.required()) ||
+      findAnnotation(field, classOf[NotNull]).isDefined
+
+  private def defaultValue(field: Field, instance: Option[AnyRef]): String =
+    findAnnotation(field, classOf[JsonProperty])
+      .map(_.defaultValue())
+      .filter(v => v.nonEmpty && v != "\u0000")
+      .orElse(instance.flatMap { inst =>
+        field.setAccessible(true)
+        Try(field.get(inst)).toOption.flatMap(formatDefault)
+      })
+      .getOrElse("-")
+
+  private def formatDefault(value: Any): Option[String] =
+    value match {
+      case null | None | "" | Nil                    => None
+      case Some(inner)                               => formatDefault(inner)
+      case xs: scala.collection.Iterable[_]          => Some(s"[${xs.size} 
items]")
+      case xs: java.util.Collection[_] if xs.isEmpty => None
+      case xs: java.util.Collection[_]               => Some(s"[${xs.size} 
items]")
+      case other                                     => Some(other.toString)
+    }
+
+  private def description(field: Field, owner: Class[_]): Option[String] = {
+    val base = getterAnnotation(field, classOf[JsonPropertyDescription], owner)
+      .orElse(findAnnotation(field, classOf[JsonPropertyDescription]))
+      .map(_.value())
+      .orElse(findAnnotation(field, 
classOf[JsonSchemaDescription]).map(_.value()))
+      .filter(_.nonEmpty)
+      .map(s => s"${s.head.toUpper}${s.tail}".stripSuffix("."))
+    val constraints = findAnnotation(field, classOf[Size]).toList.flatMap { 
size =>
+      Option(size.min()).filter(_ > 0).map(m => s"min: $m") ++
+        Option(size.max()).filter(_ < Int.MaxValue).map(m => s"max: $m") ++
+        Option(size.message()).filter(m => m.nonEmpty && !m.startsWith("{"))
+    }
+    (base, constraints) match {
+      case (Some(b), Nil) => Some(b)
+      case (Some(b), cs)  => Some(s"$b (${cs.mkString(", ")})")
+      case (None, Nil)    => None
+      case (None, cs)     => Some(cs.mkString(", "))
+    }
+  }
+
+  private def hideRule(field: Field): Option[HideRule] =
+    findAnnotation(field, classOf[JsonSchemaInject]).flatMap { inject =>
+      val strings = inject.strings().map(s => s.path() -> s.value()).toMap
+      for {
+        target <- strings.get(HideAnnotation.hideTarget)
+        hideType <- strings.get(HideAnnotation.hideType)
+        expected <- strings.get(HideAnnotation.hideExpectedValue)
+      } yield HideRule(target, hideType, expected)
+    }
+
+  private def toggledFields(field: Field): List[String] =
+    findAnnotation(field, classOf[JsonSchemaInject]).toList.flatMap { inject =>
+      Try(mapper.readTree(inject.json()).get("toggleHidden")).toOption
+        .filter(_ != null)
+        .toList
+        .flatMap(_.asScala.map(_.asText()))
+    }
+
+  // Erasure hides the element type of Option/List fields; descriptors name it 
with contentAs.
+  private def contentAs(field: Field): Option[Class[_]] =
+    findAnnotation(field, classOf[JsonDeserialize])
+      .map(_.contentAs())
+      .filter(c => c != classOf[Void] && c != classOf[Object])
+
+  // The frontend opens the code editor for exactly this description.
+  private def codeTemplate(field: Field): Option[String] =
+    findAnnotation(field, classOf[JsonPropertyDescription])
+      .filter(_.value().equalsIgnoreCase("Input your code here"))
+      .flatMap(_ => findAnnotation(field, classOf[JsonProperty]))
+      .map(_.defaultValue())
+      .filter(_.nonEmpty)
+
+  // Mirrors the frontend's CodeEditorComponent, which picks the language by 
operator type.
+  private def codeLanguage(clazz: Class[_]): String = {
+    val name = clazz.getSimpleName
+    if (name.contains("Python")) "python" else if (name.startsWith("RUDF")) 
"r" else "java"
+  }
+
+  private def dataTypeAndChildren(
+      field: Field,
+      owner: Class[_],
+      rootPath: String
+  ): (String, List[DocProperty]) = {
+    if (codeTemplate(field).isDefined) return (s"Code 
(${codeLanguage(owner)})", Nil)
+    val accepted = attributeTypeRules(owner).getOrElse(jsonName(field), Nil)
+    val (dataType, children) = plainTypeAndChildren(field, owner, rootPath)
+    (if (accepted.isEmpty) dataType else s"$dataType (${accepted.mkString(", 
")})", children)
+  }
+
+  private def plainTypeAndChildren(
+      field: Field,
+      owner: Class[_],
+      rootPath: String
+  ): (String, List[DocProperty]) = {
+
+    val raw = field.getType
+    val typeArgs = field.getGenericType match {
+      case pt: ParameterizedType =>
+        pt.getActualTypeArguments.toList.collect {
+          case c: Class[_]          => c
+          case p: ParameterizedType => p.getRawType.asInstanceOf[Class[_]]
+        }
+      case _ => Nil
+    }
+    val element = contentAs(field).orElse(typeArgs.lastOption.filter(_ != 
classOf[Object]))
+
+    if (classOf[Option[_]].isAssignableFrom(raw)) {
+      (element.map(simpleType).getOrElse("Object"), Nil)
+    } else if (
+      classOf[scala.collection.Iterable[_]].isAssignableFrom(raw) ||
+      classOf[java.lang.Iterable[_]].isAssignableFrom(raw)
+    ) {
+      element match {
+        case Some(c) if c == classOf[HyperParameters[_]] =>
+          val link = getEnumClass(owner).map { e =>
+            
s"[${e.getSimpleName}](${rootPath}parameters/${parameterPageSlug(e)}/)"
+          }
+          (link.getOrElse("List<Parameter>"), Nil)
+        case Some(c) if isNestedConfig(c) =>
+          (s"List<${toTitleCase(c.getSimpleName)}>", extractProperties(c, 
rootPath))
+        case Some(c) => (s"List<${simpleType(c)}>", Nil)
+        case None    => ("List", Nil)
+      }
+    } else {
+      (simpleType(raw), Nil)
+    }
+  }
+
+  private def simpleType(c: Class[_]): String =
+    if (c.isEnum) enumOptions(c)
+    else
+      c.getSimpleName match {
+        case "int" | "Integer"     => "Integer"
+        case "long" | "Long"       => "Long"
+        case "double" | "Double"   => "Double"
+        case "float" | "Float"     => "Float"
+        case "boolean" | "Boolean" => "Boolean"
+        case other                 => other
+      }
+
+  private def enumOptions(enumClass: Class[_]): String = {
+    val jsonValue = enumClass.getMethods.find { m =>
+      m.getAnnotation(classOf[JsonValue]) != null && m.getParameterCount == 0
+    }
+    val options = enumConstants(enumClass)
+      .map(c => jsonValue.flatMap(m => 
Try(m.invoke(c).toString).toOption).getOrElse(c.toString))
+      .filter(_.nonEmpty)
+    wrap(options.mkString(", "), 40, ", ")
+  }
+
+  private def isNestedConfig(c: Class[_]): Boolean =
+    !c.isEnum && !c.getName.startsWith("java.") && 
!c.getName.startsWith("scala.") &&
+      documentableFields(c).nonEmpty
+
+  private def attributeTypeRules(clazz: Class[_]): Map[String, List[String]] = 
{
+    val injected = Iterator
+      .iterate[Class[_]](clazz)(_.getSuperclass)
+      .takeWhile(c => c != null && c != classOf[Object])
+      .flatMap(c => Option(c.getAnnotation(classOf[JsonSchemaInject])))
+      .map(_.json())
+      .filter(_.nonEmpty)
+      .toList
+    injected.flatMap { json =>
+      Try(mapper.readTree(json).get("attributeTypeRules")).toOption
+        .filter(rules => rules != null && rules.isObject)
+        .toList
+        .flatMap { rules =>
+          rules.properties().asScala.map { entry =>
+            val value = entry.getValue
+            val accepted =
+              if (value.has("enum")) 
value.get("enum").asScala.map(_.asText()).toList
+              else if (value.isTextual) List(value.asText())
+              else Nil

Review Comment:
   Could conditional and relative column type rules be included here? The 
generated Aggregate reference omits SUM's accepted types and CONCAT's 
string-only rule. Hash Join's same-type key constraint is also lost. I 
reproduced both with the actual helper; direct enum rules work.



##########
docs/operator-reference/src/main/scala/org/apache/texera/operatorreference/JsonPropertyReflectionUtils.scala:
##########
@@ -0,0 +1,498 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.operatorreference
+
+import com.fasterxml.jackson.annotation.{
+  JsonCreator,
+  JsonIgnore,
+  JsonIgnoreProperties,
+  JsonProperty,
+  JsonPropertyDescription,
+  JsonValue
+}
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.kjetland.jackson.jsonSchema.annotations.{
+  JsonSchemaDescription,
+  JsonSchemaInject,
+  JsonSchemaTitle
+}
+import org.apache.texera.amber.core.workflow.OutputPort.OutputMode
+import org.apache.texera.amber.operator.LogicalOp
+import org.apache.texera.amber.operator.metadata.OperatorMetadataGenerator
+import org.apache.texera.amber.operator.machineLearning.sklearnAdvanced.base.{
+  HyperParameters,
+  ParamClass
+}
+import org.apache.texera.amber.operator.metadata.annotations.HideAnnotation
+
+import java.lang.annotation.Annotation
+import java.lang.reflect.{Field, Modifier, ParameterizedType}
+import javax.validation.constraints.{NotNull, Size}
+import scala.jdk.CollectionConverters._
+import scala.util.Try
+
+private[operatorreference] case class DocProperty(
+    displayName: String,
+    required: Boolean,
+    dataType: String,
+    defaultValue: String,
+    description: String,
+    children: List[DocProperty] = Nil,
+    codeTemplate: Option[String] = None
+)
+
+private[operatorreference] case class EnumParam(
+    name: String,
+    paramType: String,
+    defaultValue: String,
+    constraint: String
+)
+
+object JsonPropertyReflectionUtils {
+
+  private case class HideRule(target: String, hideType: String, expected: 
String)
+
+  // The section headings of the hand-written output-modes.md page.
+  private val OutputModeLabels: Map[OutputMode, String] = Map(
+    OutputMode.SET_SNAPSHOT -> "Set Snapshot",
+    OutputMode.SET_DELTA -> "Delta Updates",
+    OutputMode.SINGLE_SNAPSHOT -> "Single Snapshot"
+  )
+  private val HideEquals = HideAnnotation.Type.`equals`
+  private val HideRegex = HideAnnotation.Type.regex
+  private val mapper = new ObjectMapper()
+
+  def generatePropertiesTable(clazz: Class[_], rootPath: String): 
Option[String] = {
+    val properties = extractProperties(clazz, rootPath)
+    if (properties.isEmpty) return None
+
+    def escapeCell(s: String) = s.replace("\n", " ").replace("\r", " 
").replace("|", "\\|")
+    def renderRows(p: DocProperty, depth: Int): List[String] = {
+      val indent = if (depth == 0) "" else "&nbsp;&nbsp;" * (depth - 1) + "↳ "
+      val requirement = if (p.required) "✓" else ""
+      val row =
+        s"| ${escapeCell(indent + p.displayName)} | $requirement | 
${escapeCell(p.dataType)} | " +
+          s"${escapeCell(p.defaultValue)} | ${wrap(escapeCell(p.description), 
50, " ")} |"
+      row :: p.children.flatMap(renderRows(_, depth + 1))
+    }
+    val table =
+      ("| Property | Requirement | Type | Default | Description |" ::
+        "|----------|-------------|------|---------|-------------|" :: 
properties.flatMap(
+        renderRows(_, 0)
+      ))
+        .mkString("\n")
+
+    val templates = properties.flatMap(p => p.codeTemplate.map(t => 
(p.displayName, t)))
+    if (templates.isEmpty) Some(table)
+    else {
+      val language = codeLanguage(clazz)
+      val sections = templates.map {
+        case (name, template) => s"**$name**\n\n```$language\n$template\n```"
+      }
+      Some(table + "\n\n#### Default Code Template\n\n" + 
sections.mkString("\n\n"))
+    }
+  }
+
+  def generateOutputSection(clazz: Class[_], rootPath: String): String = {
+    val ports = createInstance(clazz).collect { case op: LogicalOp => 
op.operatorInfo.outputPorts }
+    if (ports.isEmpty) return "*Output ports unavailable: the descriptor could 
not be instantiated*"
+    if (ports.get.isEmpty) return "*No output ports*"
+
+    val rows = ports.get.zipWithIndex.map {
+      case (port, idx) =>
+        val label = OutputModeLabels.getOrElse(port.mode, port.mode.name)
+        val anchor = label.toLowerCase.replace(' ', '-')
+        s"| $idx | [$label](${rootPath}output-modes/#$anchor) |"
+    }
+    ("### Output Ports\n\n| Port | Mode |\n|------|------|" :: 
rows).mkString("\n")
+  }
+
+  def getEnumClass(operatorClass: Class[_]): Option[Class[_]] =
+    operatorClass.getGenericSuperclass match {
+      case pt: ParameterizedType =>
+        pt.getActualTypeArguments.headOption.collect { case c: Class[_] if 
c.isEnum => c }
+      case _ => None
+    }
+
+  def extractEnumMetadata(enumClass: Class[_]): List[EnumParam] =
+    enumConstants(enumClass).collect {
+      case p: ParamClass =>
+        // getType is the Python converter the generated code applies to the 
chosen value.
+        val paramType = p.getType
+        val constraint =
+          if (p.getAllowedValues.nonEmpty) p.getAllowedValues.mkString(", ")
+          else if (p.getMinimum.nonEmpty) p.getMinimum
+          else "-"
+        EnumParam(
+          p.getName,
+          paramType,
+          Some(p.getSampleValue).filter(_.nonEmpty).getOrElse("-"),
+          constraint
+        )
+    }
+
+  private def extractProperties(clazz: Class[_], rootPath: String): 
List[DocProperty] = {
+    val instance = createInstance(clazz)
+    val fields = documentableFields(clazz)
+    val byJsonName = fields.map(f => jsonName(f) -> f).toMap
+
+    def toggleParent(field: Field): Option[Field] =
+      fields
+        .find(t => toggledFields(t).exists(n => n == field.getName || n == 
jsonName(field)))
+        .orElse {
+          hideRule(field).collect {
+            case HideRule(target, HideEquals, _) =>
+              byJsonName.get(target).filter { t =>
+                Set[Class[_]](classOf[Boolean], classOf[java.lang.Boolean])
+                  .exists(b => t.getType == b || contentAs(t).contains(b))
+              }
+          }.flatten
+        }
+
+    def toProperty(field: Field): DocProperty = {
+      val (dataType, children) = dataTypeAndChildren(field, clazz, rootPath)
+      val template = codeTemplate(field)
+      val hideNote = hideRule(field).map {
+        case HideRule(target, HideRegex, expected) =>
+          s"Hidden when ${targetLabel(target, byJsonName)} matches `$expected`"
+        case HideRule(target, _, expected) =>
+          s"Hidden when ${targetLabel(target, byJsonName)} is `$expected`"
+      }
+      DocProperty(
+        displayName(field),
+        isRequired(field),
+        dataType,
+        if (template.isDefined) "`See template below`" else 
defaultValue(field, instance),
+        (description(field, clazz) ++ hideNote)
+          .reduceOption((a, b) => if (a.endsWith(".") || a.endsWith(")")) s"$a 
$b" else s"$a. $b")
+          .getOrElse(""),
+        children,
+        template
+      )
+    }
+
+    fields.filter(f => toggleParent(f).isEmpty).map { field =>
+      val property = toProperty(field)
+      val toggled = fields.filter(g => 
toggleParent(g).contains(field)).map(toProperty)
+      property.copy(children = property.children ++ toggled)
+    }
+  }
+
+  private def targetLabel(target: String, byJsonName: Map[String, Field]): 
String =
+    s"`${byJsonName.get(target).map(displayName).getOrElse(target)}`"
+
+  private def documentableFields(clazz: Class[_]): List[Field] = {
+    val schemaOrder = schemaPropertyOrder(clazz)
+    val chain = Iterator
+      .iterate[Class[_]](clazz)(_.getSuperclass)
+      .takeWhile(c => c != null && c != classOf[Object] && c != 
classOf[LogicalOp])
+      .toList
+      .reverse
+    val ignored = chain
+      .flatMap(c => Option(c.getAnnotation(classOf[JsonIgnoreProperties])))
+      .flatMap(_.value())
+      .toSet
+    chain
+      .flatMap(_.getDeclaredFields)
+      .filterNot(f => f.isSynthetic || Modifier.isStatic(f.getModifiers) || 
f.getName.contains("$"))
+      .filterNot(f =>
+        ignored.contains(f.getName) || findAnnotation(f, 
classOf[JsonIgnore]).isDefined
+      )
+      .filter { f =>
+        findAnnotation(f, classOf[JsonProperty]).isDefined ||
+        findAnnotation(f, classOf[JsonSchemaTitle]).isDefined ||
+        findAnnotation(f, classOf[JsonPropertyDescription]).isDefined ||
+        findAnnotation(f, classOf[JsonSchemaDescription]).isDefined
+      }
+      .groupBy(_.getName)
+      .values
+      .map(_.last)
+      .toList
+      .sortBy(f => schemaOrder.indexOf(jsonName(f)))
+  }
+
+  // The property panel lists properties in the JSON schema's order, so the 
pages do too.
+  private def schemaPropertyOrder(clazz: Class[_]): List[String] =
+    
Try(OperatorMetadataGenerator.jsonSchemaGenerator.generateJsonSchema(clazz)).toOption
+      .map(_.path("properties").fieldNames().asScala.toList)
+      .getOrElse(Nil)
+
+  private def jsonName(field: Field): String =
+    findAnnotation(field, classOf[JsonProperty])
+      .map(_.value())
+      .filter(_.nonEmpty)
+      .getOrElse(field.getName)
+
+  private def displayName(field: Field): String =
+    findAnnotation(field, classOf[JsonSchemaTitle])
+      .map(_.value())
+      .filter(_.nonEmpty)
+      .getOrElse(toTitleCase(jsonName(field)))
+
+  private def isRequired(field: Field): Boolean =
+    findAnnotation(field, classOf[JsonProperty]).exists(_.required()) ||
+      findAnnotation(field, classOf[NotNull]).isDefined
+
+  private def defaultValue(field: Field, instance: Option[AnyRef]): String =
+    findAnnotation(field, classOf[JsonProperty])
+      .map(_.defaultValue())
+      .filter(v => v.nonEmpty && v != "\u0000")
+      .orElse(instance.flatMap { inst =>
+        field.setAccessible(true)
+        Try(field.get(inst)).toOption.flatMap(formatDefault)
+      })
+      .getOrElse("-")
+
+  private def formatDefault(value: Any): Option[String] =
+    value match {
+      case null | None | "" | Nil                    => None
+      case Some(inner)                               => formatDefault(inner)
+      case xs: scala.collection.Iterable[_]          => Some(s"[${xs.size} 
items]")
+      case xs: java.util.Collection[_] if xs.isEmpty => None
+      case xs: java.util.Collection[_]               => Some(s"[${xs.size} 
items]")
+      case other                                     => Some(other.toString)

Review Comment:
   Range Slider's default is generated as `NOTHING`, but its allowed values are 
`Nothing`, `Mean` and `Sum`. The configured ObjectMapper accepts `Nothing` and 
rejects `NOTHING`. Please serialize enum defaults using `@JsonValue`, as 
`enumOptions` already does, and add a regression test for the Default cell.



##########
docs/operator-reference/src/main/scala/org/apache/texera/operatorreference/JsonPropertyReflectionUtils.scala:
##########
@@ -0,0 +1,498 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.operatorreference
+
+import com.fasterxml.jackson.annotation.{
+  JsonCreator,
+  JsonIgnore,
+  JsonIgnoreProperties,
+  JsonProperty,
+  JsonPropertyDescription,
+  JsonValue
+}
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.kjetland.jackson.jsonSchema.annotations.{
+  JsonSchemaDescription,
+  JsonSchemaInject,
+  JsonSchemaTitle
+}
+import org.apache.texera.amber.core.workflow.OutputPort.OutputMode
+import org.apache.texera.amber.operator.LogicalOp
+import org.apache.texera.amber.operator.metadata.OperatorMetadataGenerator
+import org.apache.texera.amber.operator.machineLearning.sklearnAdvanced.base.{
+  HyperParameters,
+  ParamClass
+}
+import org.apache.texera.amber.operator.metadata.annotations.HideAnnotation
+
+import java.lang.annotation.Annotation
+import java.lang.reflect.{Field, Modifier, ParameterizedType}
+import javax.validation.constraints.{NotNull, Size}
+import scala.jdk.CollectionConverters._
+import scala.util.Try
+
+private[operatorreference] case class DocProperty(
+    displayName: String,
+    required: Boolean,
+    dataType: String,
+    defaultValue: String,
+    description: String,
+    children: List[DocProperty] = Nil,
+    codeTemplate: Option[String] = None
+)
+
+private[operatorreference] case class EnumParam(
+    name: String,
+    paramType: String,
+    defaultValue: String,
+    constraint: String
+)
+
+object JsonPropertyReflectionUtils {
+
+  private case class HideRule(target: String, hideType: String, expected: 
String)
+
+  // The section headings of the hand-written output-modes.md page.
+  private val OutputModeLabels: Map[OutputMode, String] = Map(
+    OutputMode.SET_SNAPSHOT -> "Set Snapshot",
+    OutputMode.SET_DELTA -> "Delta Updates",
+    OutputMode.SINGLE_SNAPSHOT -> "Single Snapshot"
+  )
+  private val HideEquals = HideAnnotation.Type.`equals`
+  private val HideRegex = HideAnnotation.Type.regex
+  private val mapper = new ObjectMapper()
+
+  def generatePropertiesTable(clazz: Class[_], rootPath: String): 
Option[String] = {
+    val properties = extractProperties(clazz, rootPath)
+    if (properties.isEmpty) return None
+
+    def escapeCell(s: String) = s.replace("\n", " ").replace("\r", " 
").replace("|", "\\|")
+    def renderRows(p: DocProperty, depth: Int): List[String] = {
+      val indent = if (depth == 0) "" else "&nbsp;&nbsp;" * (depth - 1) + "↳ "
+      val requirement = if (p.required) "✓" else ""
+      val row =
+        s"| ${escapeCell(indent + p.displayName)} | $requirement | 
${escapeCell(p.dataType)} | " +
+          s"${escapeCell(p.defaultValue)} | ${wrap(escapeCell(p.description), 
50, " ")} |"
+      row :: p.children.flatMap(renderRows(_, depth + 1))
+    }
+    val table =
+      ("| Property | Requirement | Type | Default | Description |" ::
+        "|----------|-------------|------|---------|-------------|" :: 
properties.flatMap(
+        renderRows(_, 0)
+      ))
+        .mkString("\n")
+
+    val templates = properties.flatMap(p => p.codeTemplate.map(t => 
(p.displayName, t)))
+    if (templates.isEmpty) Some(table)
+    else {
+      val language = codeLanguage(clazz)
+      val sections = templates.map {
+        case (name, template) => s"**$name**\n\n```$language\n$template\n```"
+      }
+      Some(table + "\n\n#### Default Code Template\n\n" + 
sections.mkString("\n\n"))
+    }
+  }
+
+  def generateOutputSection(clazz: Class[_], rootPath: String): String = {
+    val ports = createInstance(clazz).collect { case op: LogicalOp => 
op.operatorInfo.outputPorts }
+    if (ports.isEmpty) return "*Output ports unavailable: the descriptor could 
not be instantiated*"
+    if (ports.get.isEmpty) return "*No output ports*"
+
+    val rows = ports.get.zipWithIndex.map {
+      case (port, idx) =>
+        val label = OutputModeLabels.getOrElse(port.mode, port.mode.name)
+        val anchor = label.toLowerCase.replace(' ', '-')
+        s"| $idx | [$label](${rootPath}output-modes/#$anchor) |"
+    }
+    ("### Output Ports\n\n| Port | Mode |\n|------|------|" :: 
rows).mkString("\n")
+  }
+
+  def getEnumClass(operatorClass: Class[_]): Option[Class[_]] =
+    operatorClass.getGenericSuperclass match {
+      case pt: ParameterizedType =>
+        pt.getActualTypeArguments.headOption.collect { case c: Class[_] if 
c.isEnum => c }
+      case _ => None
+    }
+
+  def extractEnumMetadata(enumClass: Class[_]): List[EnumParam] =
+    enumConstants(enumClass).collect {
+      case p: ParamClass =>
+        // getType is the Python converter the generated code applies to the 
chosen value.
+        val paramType = p.getType
+        val constraint =
+          if (p.getAllowedValues.nonEmpty) p.getAllowedValues.mkString(", ")
+          else if (p.getMinimum.nonEmpty) p.getMinimum
+          else "-"
+        EnumParam(
+          p.getName,
+          paramType,
+          Some(p.getSampleValue).filter(_.nonEmpty).getOrElse("-"),

Review Comment:
   Nonblocking: could this column be named `Example`? `ParamClass` explicitly 
defines `getSampleValue` as an example. The generated KNN table shows 
`metric_params` as `{}`, although its default is `None`, and shows `weights` as 
`-`, although its default is `uniform`.



##########
docs/operator-reference/src/main/scala/org/apache/texera/operatorreference/JsonPropertyReflectionUtils.scala:
##########
@@ -0,0 +1,498 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.operatorreference
+
+import com.fasterxml.jackson.annotation.{
+  JsonCreator,
+  JsonIgnore,
+  JsonIgnoreProperties,
+  JsonProperty,
+  JsonPropertyDescription,
+  JsonValue
+}
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.kjetland.jackson.jsonSchema.annotations.{
+  JsonSchemaDescription,
+  JsonSchemaInject,
+  JsonSchemaTitle
+}
+import org.apache.texera.amber.core.workflow.OutputPort.OutputMode
+import org.apache.texera.amber.operator.LogicalOp
+import org.apache.texera.amber.operator.metadata.OperatorMetadataGenerator
+import org.apache.texera.amber.operator.machineLearning.sklearnAdvanced.base.{
+  HyperParameters,
+  ParamClass
+}
+import org.apache.texera.amber.operator.metadata.annotations.HideAnnotation
+
+import java.lang.annotation.Annotation
+import java.lang.reflect.{Field, Modifier, ParameterizedType}
+import javax.validation.constraints.{NotNull, Size}
+import scala.jdk.CollectionConverters._
+import scala.util.Try
+
+private[operatorreference] case class DocProperty(
+    displayName: String,
+    required: Boolean,
+    dataType: String,
+    defaultValue: String,
+    description: String,
+    children: List[DocProperty] = Nil,
+    codeTemplate: Option[String] = None
+)
+
+private[operatorreference] case class EnumParam(
+    name: String,
+    paramType: String,
+    defaultValue: String,
+    constraint: String
+)
+
+object JsonPropertyReflectionUtils {
+
+  private case class HideRule(target: String, hideType: String, expected: 
String)
+
+  // The section headings of the hand-written output-modes.md page.
+  private val OutputModeLabels: Map[OutputMode, String] = Map(
+    OutputMode.SET_SNAPSHOT -> "Set Snapshot",
+    OutputMode.SET_DELTA -> "Delta Updates",
+    OutputMode.SINGLE_SNAPSHOT -> "Single Snapshot"
+  )
+  private val HideEquals = HideAnnotation.Type.`equals`
+  private val HideRegex = HideAnnotation.Type.regex
+  private val mapper = new ObjectMapper()
+
+  def generatePropertiesTable(clazz: Class[_], rootPath: String): 
Option[String] = {
+    val properties = extractProperties(clazz, rootPath)
+    if (properties.isEmpty) return None
+
+    def escapeCell(s: String) = s.replace("\n", " ").replace("\r", " 
").replace("|", "\\|")
+    def renderRows(p: DocProperty, depth: Int): List[String] = {
+      val indent = if (depth == 0) "" else "&nbsp;&nbsp;" * (depth - 1) + "↳ "
+      val requirement = if (p.required) "✓" else ""
+      val row =
+        s"| ${escapeCell(indent + p.displayName)} | $requirement | 
${escapeCell(p.dataType)} | " +
+          s"${escapeCell(p.defaultValue)} | ${wrap(escapeCell(p.description), 
50, " ")} |"
+      row :: p.children.flatMap(renderRows(_, depth + 1))
+    }
+    val table =
+      ("| Property | Requirement | Type | Default | Description |" ::
+        "|----------|-------------|------|---------|-------------|" :: 
properties.flatMap(
+        renderRows(_, 0)
+      ))
+        .mkString("\n")
+
+    val templates = properties.flatMap(p => p.codeTemplate.map(t => 
(p.displayName, t)))
+    if (templates.isEmpty) Some(table)
+    else {
+      val language = codeLanguage(clazz)
+      val sections = templates.map {
+        case (name, template) => s"**$name**\n\n```$language\n$template\n```"
+      }
+      Some(table + "\n\n#### Default Code Template\n\n" + 
sections.mkString("\n\n"))
+    }
+  }
+
+  def generateOutputSection(clazz: Class[_], rootPath: String): String = {
+    val ports = createInstance(clazz).collect { case op: LogicalOp => 
op.operatorInfo.outputPorts }
+    if (ports.isEmpty) return "*Output ports unavailable: the descriptor could 
not be instantiated*"
+    if (ports.get.isEmpty) return "*No output ports*"
+
+    val rows = ports.get.zipWithIndex.map {
+      case (port, idx) =>
+        val label = OutputModeLabels.getOrElse(port.mode, port.mode.name)
+        val anchor = label.toLowerCase.replace(' ', '-')
+        s"| $idx | [$label](${rootPath}output-modes/#$anchor) |"
+    }
+    ("### Output Ports\n\n| Port | Mode |\n|------|------|" :: 
rows).mkString("\n")
+  }
+
+  def getEnumClass(operatorClass: Class[_]): Option[Class[_]] =
+    operatorClass.getGenericSuperclass match {
+      case pt: ParameterizedType =>
+        pt.getActualTypeArguments.headOption.collect { case c: Class[_] if 
c.isEnum => c }
+      case _ => None
+    }
+
+  def extractEnumMetadata(enumClass: Class[_]): List[EnumParam] =
+    enumConstants(enumClass).collect {
+      case p: ParamClass =>
+        // getType is the Python converter the generated code applies to the 
chosen value.
+        val paramType = p.getType
+        val constraint =
+          if (p.getAllowedValues.nonEmpty) p.getAllowedValues.mkString(", ")
+          else if (p.getMinimum.nonEmpty) p.getMinimum
+          else "-"
+        EnumParam(
+          p.getName,
+          paramType,
+          Some(p.getSampleValue).filter(_.nonEmpty).getOrElse("-"),
+          constraint
+        )
+    }
+
+  private def extractProperties(clazz: Class[_], rootPath: String): 
List[DocProperty] = {
+    val instance = createInstance(clazz)
+    val fields = documentableFields(clazz)
+    val byJsonName = fields.map(f => jsonName(f) -> f).toMap
+
+    def toggleParent(field: Field): Option[Field] =
+      fields
+        .find(t => toggledFields(t).exists(n => n == field.getName || n == 
jsonName(field)))
+        .orElse {
+          hideRule(field).collect {
+            case HideRule(target, HideEquals, _) =>
+              byJsonName.get(target).filter { t =>
+                Set[Class[_]](classOf[Boolean], classOf[java.lang.Boolean])
+                  .exists(b => t.getType == b || contentAs(t).contains(b))
+              }
+          }.flatten
+        }
+
+    def toProperty(field: Field): DocProperty = {
+      val (dataType, children) = dataTypeAndChildren(field, clazz, rootPath)
+      val template = codeTemplate(field)
+      val hideNote = hideRule(field).map {
+        case HideRule(target, HideRegex, expected) =>
+          s"Hidden when ${targetLabel(target, byJsonName)} matches `$expected`"
+        case HideRule(target, _, expected) =>
+          s"Hidden when ${targetLabel(target, byJsonName)} is `$expected`"
+      }
+      DocProperty(
+        displayName(field),
+        isRequired(field),
+        dataType,
+        if (template.isDefined) "`See template below`" else 
defaultValue(field, instance),
+        (description(field, clazz) ++ hideNote)
+          .reduceOption((a, b) => if (a.endsWith(".") || a.endsWith(")")) s"$a 
$b" else s"$a. $b")
+          .getOrElse(""),
+        children,
+        template
+      )
+    }
+
+    fields.filter(f => toggleParent(f).isEmpty).map { field =>
+      val property = toProperty(field)
+      val toggled = fields.filter(g => 
toggleParent(g).contains(field)).map(toProperty)
+      property.copy(children = property.children ++ toggled)
+    }
+  }
+
+  private def targetLabel(target: String, byJsonName: Map[String, Field]): 
String =
+    s"`${byJsonName.get(target).map(displayName).getOrElse(target)}`"
+
+  private def documentableFields(clazz: Class[_]): List[Field] = {
+    val schemaOrder = schemaPropertyOrder(clazz)
+    val chain = Iterator
+      .iterate[Class[_]](clazz)(_.getSuperclass)
+      .takeWhile(c => c != null && c != classOf[Object] && c != 
classOf[LogicalOp])
+      .toList
+      .reverse
+    val ignored = chain
+      .flatMap(c => Option(c.getAnnotation(classOf[JsonIgnoreProperties])))
+      .flatMap(_.value())
+      .toSet
+    chain
+      .flatMap(_.getDeclaredFields)
+      .filterNot(f => f.isSynthetic || Modifier.isStatic(f.getModifiers) || 
f.getName.contains("$"))
+      .filterNot(f =>
+        ignored.contains(f.getName) || findAnnotation(f, 
classOf[JsonIgnore]).isDefined
+      )
+      .filter { f =>
+        findAnnotation(f, classOf[JsonProperty]).isDefined ||
+        findAnnotation(f, classOf[JsonSchemaTitle]).isDefined ||
+        findAnnotation(f, classOf[JsonPropertyDescription]).isDefined ||
+        findAnnotation(f, classOf[JsonSchemaDescription]).isDefined
+      }
+      .groupBy(_.getName)
+      .values
+      .map(_.last)
+      .toList
+      .sortBy(f => schemaOrder.indexOf(jsonName(f)))
+  }
+
+  // The property panel lists properties in the JSON schema's order, so the 
pages do too.
+  private def schemaPropertyOrder(clazz: Class[_]): List[String] =
+    
Try(OperatorMetadataGenerator.jsonSchemaGenerator.generateJsonSchema(clazz)).toOption
+      .map(_.path("properties").fieldNames().asScala.toList)
+      .getOrElse(Nil)
+
+  private def jsonName(field: Field): String =
+    findAnnotation(field, classOf[JsonProperty])
+      .map(_.value())
+      .filter(_.nonEmpty)
+      .getOrElse(field.getName)
+
+  private def displayName(field: Field): String =
+    findAnnotation(field, classOf[JsonSchemaTitle])
+      .map(_.value())
+      .filter(_.nonEmpty)
+      .getOrElse(toTitleCase(jsonName(field)))
+
+  private def isRequired(field: Field): Boolean =
+    findAnnotation(field, classOf[JsonProperty]).exists(_.required()) ||
+      findAnnotation(field, classOf[NotNull]).isDefined
+
+  private def defaultValue(field: Field, instance: Option[AnyRef]): String =
+    findAnnotation(field, classOf[JsonProperty])
+      .map(_.defaultValue())
+      .filter(v => v.nonEmpty && v != "\u0000")
+      .orElse(instance.flatMap { inst =>
+        field.setAccessible(true)
+        Try(field.get(inst)).toOption.flatMap(formatDefault)
+      })
+      .getOrElse("-")
+
+  private def formatDefault(value: Any): Option[String] =
+    value match {
+      case null | None | "" | Nil                    => None
+      case Some(inner)                               => formatDefault(inner)
+      case xs: scala.collection.Iterable[_]          => Some(s"[${xs.size} 
items]")
+      case xs: java.util.Collection[_] if xs.isEmpty => None
+      case xs: java.util.Collection[_]               => Some(s"[${xs.size} 
items]")
+      case other                                     => Some(other.toString)
+    }
+
+  private def description(field: Field, owner: Class[_]): Option[String] = {
+    val base = getterAnnotation(field, classOf[JsonPropertyDescription], owner)
+      .orElse(findAnnotation(field, classOf[JsonPropertyDescription]))
+      .map(_.value())
+      .orElse(findAnnotation(field, 
classOf[JsonSchemaDescription]).map(_.value()))
+      .filter(_.nonEmpty)
+      .map(s => s"${s.head.toUpper}${s.tail}".stripSuffix("."))
+    val constraints = findAnnotation(field, classOf[Size]).toList.flatMap { 
size =>

Review Comment:
   Nonblocking: could numeric bounds be included alongside `Size` constraints? 
Figure Factory Table requires Row Height to be at least 30 and Font Size to be 
non-negative, but neither restriction appears in the generated descriptions. 
The actual UI schemas reject 29 and -1, while 30 and 0 pass.



##########
docs/operator-reference/src/main/scala/org/apache/texera/operatorreference/OperatorDocScanner.scala:
##########
@@ -0,0 +1,339 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.operatorreference
+
+import org.apache.texera.amber.operator.metadata.{
+  GroupInfo,
+  OperatorMetadata,
+  OperatorMetadataGenerator
+}
+
+import java.nio.charset.StandardCharsets
+import java.nio.file.{Files, Path, Paths}
+import scala.jdk.CollectionConverters._
+
+/**
+  * Regenerates the operator reference pages from the descriptors on the 
classpath. Run it from
+  * the repository root, where the default output directory resolves:
+  *
+  *   sbt "OperatorReferenceGenerator/runMain 
org.apache.texera.operatorreference.OperatorDocScanner [outputDir]"
+  *
+  * Every markdown file under the output directory is replaced, except the 
hand-written
+  * `output-modes.md`.
+  */
+object OperatorDocScanner {
+
+  private val DefaultOutputDir = "docs/reference/operators"
+  private val HandWrittenPages = Set("output-modes.md")
+  // Placeholder operator the frontend never lists; it gets no renderPage.
+  private val HiddenOperatorTypes = Set("Dummy")
+
+  private val LicenseHeader =
+    """<!--
+      |  ~ Licensed to the Apache Software Foundation (ASF) under one
+      |  ~ or more contributor license agreements.  See the NOTICE file
+      |  ~ distributed with this work for additional information
+      |  ~ regarding copyright ownership.  The ASF licenses this file
+      |  ~ to you under the Apache License, Version 2.0 (the
+      |  ~ "License"); you may not use this file except in compliance
+      |  ~ with the License.  You may obtain a copy of the License at
+      |  ~
+      |  ~   http://www.apache.org/licenses/LICENSE-2.0
+      |  ~
+      |  ~ Unless required by applicable law or agreed to in writing,
+      |  ~ software distributed under the License is distributed on an
+      |  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      |  ~ KIND, either express or implied.  See the License for the
+      |  ~ specific language governing permissions and limitations
+      |  ~ under the License.
+      |-->
+      |
+      |""".stripMargin
+
+  private case class ParameterSet(enumClass: Class[_], operators: 
List[OperatorMetadata])
+
+  private lazy val operatorClasses: Map[String, Class[_]] =
+    OperatorMetadataGenerator.operatorTypeMap.map { case (clazz, name) => name 
-> clazz }
+
+  private lazy val groupPaths: Map[String, String] = {
+    def walk(groups: List[GroupInfo], prefix: String): Map[String, String] =
+      groups.flatMap { g =>
+        val path = if (prefix.isEmpty) toSlug(g.groupName) else 
s"$prefix/${toSlug(g.groupName)}"
+        Map(g.groupName -> path) ++ walk(childGroups(g), path)
+      }.toMap
+    walk(OperatorMetadataGenerator.allOperatorMetadata.groups, "")
+  }
+
+  def main(args: Array[String]): Unit = {
+    val outputDir = Paths.get(args.headOption.getOrElse(DefaultOutputDir))
+    val metadata = OperatorMetadataGenerator.allOperatorMetadata
+    val operators =
+      metadata.operators.filterNot(op => 
HiddenOperatorTypes.contains(op.operatorType))
+    val byGroup = operators.groupBy(op => 
groupPath(op.additionalMetadata.operatorGroupName))
+
+    deleteGeneratedPages(outputDir)
+
+    operators.foreach { op =>
+      val dir = groupPath(op.additionalMetadata.operatorGroupName)
+      writeFile(outputDir.resolve(dir).resolve(s"${operatorSlug(op)}.md"), 
operatorPage(op, dir))
+    }
+    metadata.groups.zipWithIndex.foreach {
+      case (group, i) => writeGroupIndexes(outputDir, group, Nil, i + 1, 
byGroup)
+    }
+
+    val parameterSets = operators
+      .flatMap(op =>
+        
JsonPropertyReflectionUtils.getEnumClass(operatorClasses(op.operatorType)).map(_
 -> op)
+      )
+      .groupBy(_._1)
+      .map { case (enumClass, pairs) => ParameterSet(enumClass, 
pairs.map(_._2)) }
+      .toList
+      .sortBy(_.enumClass.getSimpleName)
+    parameterSets.foreach { set =>
+      val file = 
s"${JsonPropertyReflectionUtils.parameterPageSlug(set.enumClass)}.md"
+      writeFile(outputDir.resolve("parameters").resolve(file), 
parameterPage(set))
+    }
+    writeFile(outputDir.resolve("parameters/_index.md"), 
parameterIndex(parameterSets))
+    writeFile(outputDir.resolve("_index.md"), rootIndex(metadata.groups, 
byGroup))
+
+    println(
+      s"Wrote ${operators.size} operator pages, ${groupPaths.size} group 
indexes and " +
+        s"${parameterSets.size} parameter pages to $outputDir"
+    )
+  }
+
+  private def operatorPage(op: OperatorMetadata, dir: String): String = {
+    val info = op.additionalMetadata
+    val depth = dir.count(_ == '/') + 1
+    val rootPath = "../" * (depth + 1)
+    val operatorClass = operatorClasses(op.operatorType)
+
+    val frontMatter = List(
+      Some(s"""title: "${escapeYamlString(info.userFriendlyName)}""""),
+      Option(info.operatorDescription)
+        .filter(_.nonEmpty)
+        .map(d => s"""description: "${escapeYamlString(toSingleLine(d))}""""),
+      Some(s"""category: "${escapeYamlString(info.operatorGroupName)}""""),
+      Some(s"""operator_type: "${escapeYamlString(op.operatorType)}""""),
+      Some(s"tags: [${dir.replace("/", ", ")}]")
+    ).flatten
+
+    val ancestors = groupAncestry(info.operatorGroupName)
+    val breadcrumb = (s"[Home]($rootPath)" :: ancestors.zipWithIndex.map {
+      case (name, i) => s"[$name](${"../" * (ancestors.size - i)})"
+    }).mkString(" > ")
+
+    val properties = JsonPropertyReflectionUtils
+      .generatePropertiesTable(operatorClass, rootPath)
+      .map(table => s"### Input Properties\n\n$table")
+    val outputs = 
JsonPropertyReflectionUtils.generateOutputSection(operatorClass, rootPath)
+
+    renderPage(frontMatter, breadcrumb :: properties.toList ::: List(outputs))
+  }
+
+  private def writeGroupIndexes(
+      outputDir: Path,
+      group: GroupInfo,
+      ancestors: List[String],
+      weight: Int,
+      byGroup: Map[String, List[OperatorMetadata]]
+  ): Unit = {
+    val dir = groupPath(group.groupName)
+    val depth = ancestors.size + 1
+    val frontMatter = List(
+      s"""title: "${escapeYamlString(group.groupName)}"""",
+      s"""description: "Operators in the ${escapeYamlString(group.groupName)} 
category"""",
+      s"weight: $weight",
+      "categories: [Operators]",
+      s"tags: [${dir.replace("/", ", ")}]"
+    )
+    val breadcrumb = (s"[Home](${"../" * depth})" :: 
ancestors.zipWithIndex.map {
+      case (name, i) => s"[$name](${"../" * (ancestors.size - i)})"
+    } ::: List(group.groupName)).mkString(" > ")
+
+    val subcategories = Some(childGroups(group)).filter(_.nonEmpty).map { subs 
=>
+      "## Subcategories\n\n" + subs
+        .map(c => s"- [${c.groupName}](${toSlug(c.groupName)}/)")
+        .mkString("\n")
+    }
+    val operators = byGroup.get(dir).map { ops =>
+      val rows = ops.sortBy(_.additionalMetadata.userFriendlyName).map { op =>
+        val description = Option(op.additionalMetadata.operatorDescription)
+          .filter(_.nonEmpty)
+          .map(toSingleLine)
+          .getOrElse("-")
+        s"| [${op.additionalMetadata.userFriendlyName}](${operatorSlug(op)}/) 
| $description |"
+      }
+      "## Operators\n\n| Operator | Description 
|\n|----------|-------------|\n" +
+        rows.mkString("\n") + s"\n\n**Total**: ${operatorCount(ops.size)}"
+    }
+
+    writeFile(
+      outputDir.resolve(dir).resolve("_index.md"),
+      renderPage(frontMatter, breadcrumb :: subcategories.toList ::: 
operators.toList)

Review Comment:
   Running the generator removes the Python index's existing UI parameters 
walkthrough, including the `UiParameter` example and supported-type rules. 
Could we preserve that section or move it outside the generated tree? I 
reproduced this on a copy of the current reference.



-- 
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