Follow-up: Improve schema errors with custom validation
Backend
- Add errors field to GraphQL customizable dashboards DONE
Frontend
- Make sure all built-in dashboards,
behavior
,audience
,ai impact
, VSD have a valid schema file before proceeding. There could be some missing properties likeversion
, in this case, we can update the schema when needed. - Display customizable dashboard errors field on UI when present.
- Remove GraphQL not null constraints from fields of
ProductAnalytics::Dashboard
andProductAnalytics::PanelType
. We should allow all fields that are coming from the YAML schema to be nullable, at this point we will stop showing GraphQL default messages and show only related schema errors implemented in step 2.
The following discussion from !145768 (merged) should be addressed:
-
@ekigbo started a discussion: (+7 comments) Hi @ahegyi @felipe_artur looking at the additional frontend error handling for 500 error on dashboard listing with a custom YA... (#430320 - closed) and I noticed a few things that I might need some input on, or might not be lining up with the json schema. AFAICT the correct schema specification should be https://gitlab.com/gitlab-org/gitlab/-/blob/master/ee/app/validators/json_schemas/analytics_dashboard.json, but im not
💯 if thats up to date, or what we are using.I'm not sure if these make sense to address as separate improvements or if there are some quick fixes we can include here.
Improving the error graphql messages
Is there a way we can improve the graphql error messages that are returned? For example, when the
title
field is missing from the panel definition, the returned error message isGraphQL error: Cannot return null for non-nullable field CustomizableDashboardPanel.title
, which isnt too useful without a bit of understanding of how this is all setup.No error for missing
gridAttributes
fieldFrom the json schema and AFAICT, the
gridAttributes
are a required field for each panel, but if they are omitted there's no GraphQL error raised, which results in an unclear error on the frontend.500 error on dashboard list If the dashboard YAML configuration doesnt have the
panels
field, im still getting the 500Internal server error
when viewing the dashboard list, I think we might be missing an additional check in resolver for thepanels
field (i'm not too sure how its all wired togethor). According to the schema, it should be a required field