Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip TopKind in maps #70

Merged
merged 3 commits into from
Dec 23, 2022
Merged

Skip TopKind in maps #70

merged 3 commits into from
Dec 23, 2022

Conversation

spinillos
Copy link
Member

@spinillos spinillos commented Dec 22, 2022

I was testing v0.1.3 with our current cue files and I saw the following:

panels: [...(#Panel | #GraphPanel | #HeatmapPanel)] @grafanamaturity(NeedsExpertReview)

was generating:

panels?: Array<(Panel | RowPanel | {
    type: 'graph';
  } | {
    type: 'heatmap';
})>;

with 0.1.3:

panels?: Array<(Panel | Record<string, unknown> | Record<string, unknown>)>;

And its not right.

The issue came because GraphPanel and HeatmapPanel are structs with data like:

#Something: {
  foo: "bar"
  ...
}

These structs are detected as maps, their kind is cue.TopKind and we set unknown. So if we skip them, we can generate the proper value without losing information.

Note: I back any as default in TopKind kind. When we detect an empty {...} the writer is going to print Result<string, unknown> like it was doing before.

@spinillos spinillos merged commit 77a030e into main Dec 23, 2022
@spinillos spinillos deleted the skip-top-kinds-in-maps branch December 23, 2022 10:53
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.

None yet

1 participant