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

[docs] Dynamic fields example has errors #2592

Closed
SteVwonder opened this issue Sep 13, 2023 · 1 comment
Closed

[docs] Dynamic fields example has errors #2592

SteVwonder opened this issue Sep 13, 2023 · 1 comment

Comments

@SteVwonder
Copy link
Contributor

What version of CUE are you using (cue version)?

❯ cue version
cue version v0.6.0

What did you do?

I copied the dynamic fields example from the docs at https://cuelang.org/docs/references/spec/#dynamic-fields

sherbein ~/scratchspace/cue-dynamic-fields
❯ cat test.cue                     
package test

a:   "foo"
b:   "bar"
(a): "baz"

(a+b): "qux"

(a)?: string
(b)!: string

What did you expect to see?

What is listed in the docs :

a:   "foo"
b:   "bar"
bar: "baz"

foobar: "qux"

foo?: string
bar!: string

What did you see instead?

sherbein ~/scratchspace/cue-dynamic-fields
❯ cue eval                         
a:      "foo"
b:      "bar"
foo:    "baz"

foobar: "qux"

bar!:   string

The output from the command is definitely correct and the mistake lies with the docs. Basically the docs should be updated so that the result of (a): "baz" is foo: "baz" not bar: "baz". The a: "foo in the docs example also needs a closing ".

I'm happy to post a PR once I confirm employer sign-off on contributions.

@SteVwonder SteVwonder added NeedsInvestigation Triage Requires triage/attention labels Sep 13, 2023
@mvdan
Copy link
Member

mvdan commented Sep 15, 2023

Please do send a patch :) This looks wrong indeed. I also see a: "foo rather than a: "foo", a closing double quote is missing.

@mvdan mvdan added Documentation NeedsFix and removed NeedsInvestigation Triage Requires triage/attention labels Sep 15, 2023
SteVwonder added a commit to SteVwonder/cue that referenced this issue Sep 28, 2023
Since `a: "foo"` is provided in the example, the result of `(a): "baz"`
is `foo: "baz"` not `bar: "baz"`.

Also add a missing quote.

Closes: cue-lang#2592
SteVwonder added a commit to SteVwonder/cue that referenced this issue Sep 28, 2023
Since `a: "foo"` is provided in the example, the result of `(a): "baz"`
is `foo: "baz"` not `bar: "baz"`.

Also add a missing quote.

Closes: cue-lang#2592
Signed-off-by: Stephen Herbein <sherbein@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants