Skip to content

Cue: Enums as map index#1081

Open
spinillos wants to merge 7 commits into
mainfrom
cue/enums-as-map-index
Open

Cue: Enums as map index#1081
spinillos wants to merge 7 commits into
mainfrom
cue/enums-as-map-index

Conversation

@spinillos

Copy link
Copy Markdown
Member

Closes: #893

  • It allows cue parser to identify enums as map index to generate them properly in all languages.
  • Update hardcoded String in Java maps.
  • Skip factory generation in Typescript if we have maps with this kind of index and without defaults.

@spinillos spinillos self-assigned this Apr 17, 2026
@spinillos spinillos requested a review from a team as a code owner April 17, 2026 11:26
@spinillos spinillos added the enhancement New feature or request label Apr 17, 2026
@github-actions

github-actions Bot commented Apr 17, 2026

Copy link
Copy Markdown

Note: the diff show code changes that would be introduced by this PR to the output of the Grafana Foundation SDK codegen pipeline.

See full diff.

🔎 Changes to Grafana Foundation SDK

@IfSentient IfSentient left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one note about the CUE issue in the go comments

Comment thread internal/simplecue/utils.go Outdated
// It first tries v.Syntax() (the CUE Def export), but falls back to v.Source()
// when Syntax() returns a *ast.BadExpr — which happens for enum-indexed maps
// due to a CUE exporter bug: "reference in label expression refers to field
// against which it would be matched" (see https://cuelang.org/issues/new).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment just refers to the open a new issue page in the cue repo, I think it should be referring to cue-lang/cue#4291, though I may have found the wrong issue searching.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CUE: Use enums as map index, produces generic output

2 participants