cue-lang / docs-and-content

A place to discuss, plan, and track documentation on cuelang.org
6 stars 1 forks source link

howto: reference top level field that is not a valid identifier #30

Closed Rots closed 10 months ago

Rots commented 1 year ago

https://cuelang.org/docs/tutorials/tour/references/selectors/

if I have a top-level field that is not a valid identifier, how can I refer to it? I.e. what should put as a value for expectB to refer to ":a"

":a": "b"
d: ":e": "f"
expectF: d.":e"
expectB: (":a")

Is it possible to reference the root or navigate through explicitly referring to the parent of the entry?

jpluscplusm commented 11 months ago

As well as the documentation added above, which assumes the ability to add to the on-disk CUE, let's also include (as a separate howto?) the export-CLI-only solution I mentioned here: https://github.com/cue-lang/cue/issues/358#issuecomment-1585796671

jpluscplusm commented 10 months ago

Closed via https://github.com/cue-lang/cuelang.org/commit/68e815abc6fff3c2620023cd0b37b37ce3fe8b0b and https://github.com/cue-lang/cuelang.org/commit/8b67f643a1a192e3b52bc1b199f94172bb76fc21

jpluscplusm commented 10 months ago

@Rots Please let me know if/that these new docs answer your question!

Rots commented 10 months ago

Yes, that's great! Did that now require also software changes? If yes, in which release will it be available? 0.7.0?

jpluscplusm commented 10 months ago

Yes, that's great!

Fab :-)

Did that now require also software changes?

No - "alpha" is just our way of referring to the next version of the cuelang.org website. The methods outlined should already work with recent CUE releases.

If yes, in which release will it be available? 0.7.0?

It /definitely/ works with 0.7.0, as that's the version that the alpha website uses, and these examples are tested against it.