v0.15.0-alpha.3
Changes which may break some users are marked below with: ⚠️
Note that this release no longer includes a checksums.txt asset; GitHub now provide digests natively.
Evaluator
aliasv2 experiment
⚠️ The self experiment introduced in v0.15.0-alpha.2 has been renamed to aliasv2, to fully implement the Postfix Aliases proposal on GitHub.
Adding a new experiment like @experiment(postfixalias) alongside @experiment(self) was not a good option given that cue fix can only adjust existing code correctly when both experiments are enabled. Allowing the use of just one half of the experiment would add too many tricky edge cases.
Once a module’s language.version targets v0.15.0, this can be enabled via the file attribute @experiment(aliasv2). You can use cue fix --exp=aliasv2 to transition existing CUE code in a module to the new alias syntax and semantics.
Other changes
Fix a bug where required fields in a definition might not be enforced when unifying with an inline struct in an expression, such as (#RequiresFoo & {bar: "baz"}).bar.
Fix a bug where a value’s reference to self through a let declaration would hang the evaluator.
Add caching to a part of the typochecker algorithm; this has been measured to provide speed-ups of up to 30% on a few large projects.
cmd/cue
cue mod mirror now copies OCI referrers between registries, which ensures that artifacts like signatures and attestations which reference modules being mirrored are copied as well.
cue get go gains an --outfile flag to generate exactly one CUE file for a single Go package, which can be useful when integrating cue get go into build systems like Bazel.
Encodings
Initial support for encoding CUE schemas as JSON Schema is added. This includes a new encoding/jsonschema.Generate Go API, as well as CLI support via cue def --out jsonschema. This is very experimental as yet, and many features are missing. For now, it can only generate a single version of JSON Schema (draft/2020-12).
The YAML encoder no longer uses CUE’s dependency analysis algorithm. This helps prevent panics that some users had run into with cue export -e expr --out yaml.
Go API
The new cue.Value.IsClosed and cue.Value.IsClosedRecursively methods report whether a value has been closed at the top level or recursively, which is useful information when writing schema encodings.
The new cue.Patterns and cue.Selector.Pattern APIs allow introspecting pattern constraints in CUE struct values.
All changes
84 changes since v0.15.0-alpha.2by area
all6
allrename aliasandself experiment to aliasv2allgo fix -slicescontains ./...allgo fix -stringsseq ./...allapply more gopls suggestionsallfix a number of bad godocs spotted by goplsallcontinue transition away from adt.Vertex.VisitLeafConjuncts
cmd4
cmd/cueclarify what version affects experimentscmd/cueadd --outfile flag toget gocmd/cueexplain package instances in cue-help-inputscmd/cuerewrite export help text
cue12
cue/testdata/eval/bounds.txtaraccept v3 as goldencuesupport ... operator in Exprcue/ast/astutiladd resolver support for postfix aliasescueadd postfix alias syntax infrastructurecuesupport iteration over pattern constraintscueimplement IsClosed and IsClosedRecursivelycueadd test case for the fixed bug 4037cuefix panic in LookupPath on unfinalized arcscue/astsimplify IsValidIdent logic via strings.CutPrefixcuereuse internal.IsDef to tell if a name is a definitioncue/literalproperly include hashes in escape sequences in bytescue/literaladd test case for lossy bytes quoting
encoding29
encoding/jsonschemaexplicit close handlingencoding/jsonschemaadd testsencoding/jsonschemaoptimize items in definitions tooencoding/jsonschemaadd a test to check optimization in definitionsencodingfix two gopls warningsencoding/jsonschemause unique item values in Generateencoding/jsonschemarecognize pattern constraints in Generateencoding/jsonschemafix patternProperties in Extractencoding/jsonschemarecognize different forms of "const"encoding/jsonschemarecognize closed structs in Generateencoding/jsonschemaimprove teststatsencoding/jsonschematreat close as no-op for nowencoding/jsonschemarecognize list.MatchN in Generateencoding/jsonschemarecognize explicit errors in CUEencoding/jsonschemause error builtin rather than_|_encoding/jsonschemarecognize matchIf in Generateencoding/yamlconsistently use cue.Concrete when calling Value.Syntaxencoding/jsonschemause more genericsiblingsfunctionencoding/jsonschemaminor improvements to Generateencoding/jsonschemaadd a few testsencoding/jsonschemarecognize matchN in Generateencoding/jsonschemaround trip external testsencoding/jsonschemalist supportencoding/jsonschemaimprove mergeAllOf behaviorencoding/jsonschemaadjust for net/url fix in go@masterencoding/jsonschemause ast.Expr rather than mapencoding/jsonschemaadd test case for regular fieldsencoding/jsonschemaimplement Generateencoding/jsonschemaremove unused state.value method
internal25
internal/cidon't let "---" lines break git commit trailersinternal/core/adttreat equality bound as open validatorinternal/core/adtadd tests for Issue 4142internal/cibump Go and goreleaserinternal/coremake label references work for all field typesinternal/core/adtreport error for missing required fieldsinternal/core/adtadd tests for issue 3918internal/cueexperimentrename self experiment to aliasandselfinternal/ciuse unauthenticated GerritHub URLinternal/core/adtfix disjunction related mem mgmt buginternal/anyuniquenew packageinternal/core/adtcache containsDefID resultsinternal/core/adtalways print errors in leaf nodesinternal/cistop generating checksums.txt as a release archiveinternal/core/adtturn Vertex.VisitAllConjuncts into an iteratorinternal/core/...fully transition away from Vertex.VisitLeafConjunctsinternal/core/adtavoid hang on self-references through "let"internal/core/adttest TopKind in TestKindStringinternal/core/adtadd the Vertex.LeafConjuncts iteratorinternal/core/adtturn VisitConjuncts into ConjunctsSeqinternal/mod/semverclean up with cmp.Compareinternal/encodingadd jsonschema as an output formatinternal/encodingdo not require input to be concrete for concrete output formatsinternal/encodingrefactor Encoder.Encode, Encoder.EncodeFileinternal/cuetxtardo not skip tests on Instance failure
Other8
mod/modregistrymirror referrers in Client.Mirror- update all dependencies
tools/fixadd fixAliasAndSelf- cue/parser|format: implement postfix alias syntax
lsp/definitionsfix broken build due to self renaming- switch this repository to cue.gerrithub.io
- Revert "mod/modregistry: mirror referrers in Client.Mirror"
mod/modregistrymirror referrers in Client.Mirror
Downloads
Every file this release published on GitHub, with its SHA-256. Most people install CUE as Installing CUE describes, which also shows how to check a download.
Archives
| Platform | File and SHA-256 |
|---|---|
| macOS, Intel | cue_7ec9773fcd492b462748bb46c5aebf9e700971dbea66052971e6a79979a0e040 |
| macOS, Apple silicon | cue_a9db87673b331aef9aa03a0cdedb571c50f0c4147989085d416b2c5da6f6c8a4 |
| Linux, x86-64 | cue_e9be1c59c2bcb29c1f2c0dedbbc588b30c2e992777825dcfbd4b21042201da1c |
| Linux, Arm64 | cue_487cf7af4bbc18d4b584b18484c8f0adeaa337ccac5b58d4f0c7a9fbe4addf8f |
| Windows, x86-64 | cue_669c0c5904f9df3a6632281b68b40d7b36a57fb7ebd3d5fab3e68b3fbad627e4 |
| Windows, Arm64 | cue_bdb990bfa892f792851db5fd8e880917735ee7d6c5185e829cadfaf02f0bfa6b |