Skip to content

Add backend validation for all canvas component types#9246

Open
djbarnwal wants to merge 6 commits intomainfrom
feat/canvas-component-validation
Open

Add backend validation for all canvas component types#9246
djbarnwal wants to merge 6 commits intomainfrom
feat/canvas-component-validation

Conversation

@djbarnwal
Copy link
Copy Markdown
Member

@djbarnwal djbarnwal commented Apr 15, 2026

Implements backend validation for all 18 canvas component renderer types in ValidateRendererProperties.

  • Validates required and optional fields for each renderer against the referenced metrics view (dimensions, measures)
  • Groups cartesian charts (line_chart, bar_chart, area_chart, stacked_bar, stacked_bar_normalized) and circular charts (donut_chart, pie_chart) into shared validators
  • Handles special cases: metrics_sql as an alternative to metrics_view, rill_measures/measures virtual color fields (type: value), plain-string color literals
  • Adds helpers: requireMetricsView, getPathStringSlice, validateOptionalDimensionField, validateOptionalMeasureField, validateOptionalColorDimensionField
  • Adds test functions covering valid specs, invalid field references, missing required fields, and edge cases

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@djbarnwal
Copy link
Copy Markdown
Member Author

@begelundmuller The frontend canvas UI does not support metrics_sql as a renderer property for kpi or kpi_grid It is always configured with metrics_view.

However, the backend does handle metrics_sql as a generic renderer property: populateRendererRefs in reconcilers/canvas.go uses it to discover transitive metrics view references for security resolution, and canvases.go uses it during canvas resolution to extract referenced metrics views. Hence for now have added metrics_sql in the validation logic for those components.

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.

1 participant