Open myitcv opened 3 weeks ago
FWIW another possibility I've had in mind in the past is to make these schemas available in the standard library. Then they'd be available to regular CUE code, not just on the command line.
So, for example, your example cue mod schema module.cue
might be expressed as cue def mod/modulefile
or similar (modulo whatever naming might be chosen for the import path and/or definition).
Note that currently schema.cue specifies a "strict" variant. It is my understanding that we only use the strict variant, and thus this is what I would expect to be output.
FWIW we use the non-strict variant whenever cue/load loads a module , so it's actually in reasonably common use. I suspect that it might be useful to have both variants available.
Is your feature request related to a problem? Please describe.
I tried to find and run a
cue
command that showed me the effective schema applied to acue.mod/module.cue
file when validating such files. I want to consume this CUE in another process (specifically I want to render the CUE on cuelang.org in the modules reference documentation https://cuelang.org/docs/reference/modules/#cue-mod-file, rather than maintaining that copy by hand).Describe the solution you'd like
Something like this:
that would then output the raw CUE used to validate a
cue.mod/module.cue
file.Note that currently
schema.cue
specifies a "strict" variant. It is my understanding that we only use the strict variant, and thus this is what I would expect to be output.Describe alternatives you've considered
Loading https://github.com/cue-lang/cue/blob/19e990d82298ba18ca4b0ca5a0a2a60e13dc3bc5/mod/modfile/schema.cue and using some CUE logic (potentially different from the Go logic in https://github.com/cue-lang/cue/blob/19e990d82298ba18ca4b0ca5a0a2a60e13dc3bc5/mod/modfile/modfile.go) to extract the "latest" schema.
Additional context
n/a