Skip to content

Conversation

@rafbcampos
Copy link
Contributor

@rafbcampos rafbcampos commented Jan 12, 2026

Summary

This PR adds two new modules for authoring Player-UI content in Kotlin:

  1. language/dsl/kotlin - A Kotlin DSL library for building Player-UI flows and assets programmatically
  2. language/generators/kotlin - A code generator that produces Kotlin DSL builders from XLR JSON schemas
  3. xlr/types/kotlin - Kotlin XLR types and helpers

Motivation

Kotlin/Java developers currently lack a type-safe way to construct Player-UI content. This DSL provides compile-time validation and IDE support when building flows, views, and assets.

What's Included

Kotlin DSL (language/dsl/kotlin)

  • FluentBuilder base classes for creating asset builders
  • BuildPipeline for resolving nested builders, templates, and switches
  • TaggedValue types for bindings ({{path}}) and expressions (@[expr]@)
  • ID generation and context management
  • Sample builders for common assets (text, input, action, collection)

Code Generator (language/generators/kotlin)

  • Parses XLR (Cross-Language Representation) JSON schemas
  • Generates builder classes with properties, nested configs, and DSL functions
  • CLI tool for batch generation
  • Type mapping from XLR types to Kotlin types

Usage

import com.intuit.playertools.fluent.flow.flow
import com.intuit.playertools.fluent.mocks.builders.*
import com.intuit.playertools.fluent.tagged.binding

val content = flow {
    id = "registration-flow"
    views = listOf(
        collection {
            id = "form"
            label { value = "User Registration" }
            values(
                input {
                    binding("user.firstName")
                    label { value = "First Name" }
                },
                input {
                    binding("user.lastName")
                    label { value = "Last Name" }
                }
            )
            actions(
                action {
                    value = "submit"
                    label { value = "Register" }
                }
            )
        }
    )
    data = mapOf(
        "user" to mapOf(
            "firstName" to "",
            "lastName" to ""
        )
    )
    navigation = mapOf(
        "BEGIN" to "FLOW_1",
        "FLOW_1" to mapOf(
            "startState" to "VIEW_form",
            "VIEW_form" to mapOf(
                "state_type" to "VIEW",
                "ref" to "form",
                "transitions" to mapOf("submit" to "END_Done")
            ),
            "END_Done" to mapOf(
                "state_type" to "END",
                "outcome" to "done"
            )
        )
    )
}

@rafbcampos rafbcampos requested a review from a team as a code owner January 12, 2026 19:41
@rafbcampos rafbcampos self-assigned this Jan 12, 2026
@rafbcampos rafbcampos marked this pull request as draft January 12, 2026 19:44
@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.28%. Comparing base (129d3b8) to head (1723fe2).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #234   +/-   ##
=======================================
  Coverage   64.28%   64.28%           
=======================================
  Files         128      128           
  Lines       13006    13006           
  Branches     1867     1866    -1     
=======================================
  Hits         8361     8361           
  Misses       4617     4617           
  Partials       28       28           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rafbcampos
Copy link
Contributor Author

/canary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants