Skip to content

Add YAML errors field to Dashboard objects on GraphQL

Felipe Artur requested to merge issue_444915 into master

What does this MR do and why?

  1. Adds a new errors field to GraphQL which contains yaml schema errors
  2. Small simplifications to Dashboard model
  3. Fix error when panels properties are not present in the YAML

Samples of errors returned on the new field

[
    [0] "root is missing required keys: version",
    [1] "property '/panels/0' is missing required keys: queryOverrides",
    [2] "property '/panels/0/id' is invalid: error_type=schema",
    [3] "property '/panels/1' is missing required keys: queryOverrides",
    [4] "property '/panels/1/id' is invalid: error_type=schema",
    [5] "property '/panels/2' is missing required keys: queryOverrides",
    [6] "property '/panels/2/id' is invalid: error_type=schema"
]
[
    [0] "root is missing required keys: version, panels"
]

How to validate locally

  1. Enable group_analytics_dashboard_dynamic_vsd feature flag
  2. Create a group customized dashboard following these instructions.
  3. Make sure to have some errors on the schema leaving the version field empty
  4. Execute the following query:
query groupDashboard {
  group(fullPath: "vsmg-1712601311") {
    name
    customizableDashboards {
      nodes {
        title
        errors
      }
    }
  }
}

Errors should be present.

Next steps

We need to bypass GraphQL error handling to display schema errors when they are present with the following:

  1. Make sure all built-in dashboards, behavior, audience, ai impact, VSD have a valid schema before proceeding.
  2. Add frontend handling to consume dashboard errors field and present to the users properly on the UI.
  3. Remove GraphQL not null constraints from fields of ProductAnalytics::Dashboard and ProductAnalytics::PanelType. We should allow all fields that are coming from the YAML schema to be null: true preventing the default API error messages.

related to #444915 (closed)

Edited by Felipe Artur

Merge request reports