v0.15.0-alpha.3

cue-lang/cue Pre-release Released

A release of CUE OSS · its page on GitHub

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 aliasv2@mpvlb85644f
  • allgo fix -slicescontains ./...@mvdan7b65843
  • allgo fix -stringsseq ./...@mvdan2895806
  • allapply more gopls suggestions@mvdan8d2909c
  • allfix a number of bad godocs spotted by gopls@mvdan5b42b38
  • allcontinue transition away from adt.Vertex.VisitLeafConjuncts@mvdan658608c

cmd4

  • cmd/cueclarify what version affects experiments@mvdanef2044e
  • cmd/cueadd --outfile flag to get go@fioneraa6eaaf6
  • cmd/cueexplain package instances in cue-help-inputs@jpluscplusm103b1ce
  • cmd/cuerewrite export help text@jpluscplusmff5711d

cue12

  • cue/testdata/eval/bounds.txtaraccept v3 as golden@mpvlff6f38b
  • cuesupport ... operator in Expr@mpvl3d8e9ea
  • cue/ast/astutiladd resolver support for postfix aliases@mpvl4d8b1da
  • cueadd postfix alias syntax infrastructure@mpvld92ce18
  • cuesupport iteration over pattern constraints@rogpeppea6f97a1
  • cueimplement IsClosed and IsClosedRecursively@mpvlb28a5f3
  • cueadd test case for the fixed bug 4037@mvdan5c6dd1c
  • cuefix panic in LookupPath on unfinalized arcs@rogpeppe4160e88
  • cue/astsimplify IsValidIdent logic via strings.CutPrefix@mvdan53ace20
  • cuereuse internal.IsDef to tell if a name is a definition@mvdanc486bc3
  • cue/literalproperly include hashes in escape sequences in bytes@mvdand21fac3
  • cue/literaladd test case for lossy bytes quoting@mvdand8c663c

encoding29

  • encoding/jsonschemaexplicit close handling@rogpeppea94cfbc
  • encoding/jsonschemaadd tests@rogpeppe2606457
  • encoding/jsonschemaoptimize items in definitions too@rogpeppe098b6d1
  • encoding/jsonschemaadd a test to check optimization in definitions@rogpeppe29ad8ee
  • encodingfix two gopls warnings@mvdan33621a6
  • encoding/jsonschemause unique item values in Generate@rogpeppe947c85c
  • encoding/jsonschemarecognize pattern constraints in Generate@rogpeppec356c10
  • encoding/jsonschemafix patternProperties in Extract@rogpeppefc58592
  • encoding/jsonschemarecognize different forms of "const"@rogpeppe5433cb9
  • encoding/jsonschemarecognize closed structs in Generate@rogpeppe113d7b9
  • encoding/jsonschemaimprove teststats@rogpeppe28054b0
  • encoding/jsonschematreat close as no-op for now@rogpeppeb670102
  • encoding/jsonschemarecognize list.MatchN in Generate@rogpeppe09a0f42
  • encoding/jsonschemarecognize explicit errors in CUE@rogpepped293a17
  • encoding/jsonschemause error builtin rather than _|_@rogpeppe49126bb
  • encoding/jsonschemarecognize matchIf in Generate@rogpeppefedcd87
  • encoding/yamlconsistently use cue.Concrete when calling Value.Syntax@mvdan39d559b
  • encoding/jsonschemause more generic siblings function@rogpeppe366de4b
  • encoding/jsonschemaminor improvements to Generate@rogpeppe06d8b91
  • encoding/jsonschemaadd a few tests@rogpeppe2efaae1
  • encoding/jsonschemarecognize matchN in Generate@rogpeppe40a9710
  • encoding/jsonschemaround trip external tests@rogpeppe899a983
  • encoding/jsonschemalist support@rogpeppeb4b3d1b
  • encoding/jsonschemaimprove mergeAllOf behavior@rogpeppeb8e3859
  • encoding/jsonschemaadjust for net/url fix in go@master@mvdanf79aafe
  • encoding/jsonschemause ast.Expr rather than map@rogpeppe77c93c6
  • encoding/jsonschemaadd test case for regular fields@rogpeppee58947e
  • encoding/jsonschemaimplement Generate@rogpeppec60b98a
  • encoding/jsonschemaremove unused state.value method@mvdan14a7236

internal25

  • internal/cidon't let "---" lines break git commit trailers@mvdane735c99
  • internal/core/adttreat equality bound as open validator@mpvl15f2a53
  • internal/core/adtadd tests for Issue 4142@mpvlde886bc
  • internal/cibump Go and goreleaser@mvdan64a5e68
  • internal/coremake label references work for all field types@mpvl23a328a
  • internal/core/adtreport error for missing required fields@mpvla25fb94
  • internal/core/adtadd tests for issue 3918@mpvl166a851
  • internal/cueexperimentrename self experiment to aliasandself@mpvla8dce0b
  • internal/ciuse unauthenticated GerritHub URL@jpluscplusm3dabab4
  • internal/core/adtfix disjunction related mem mgmt bug@mpvl335e4fb
  • internal/anyuniquenew package@rogpeppe84c673a
  • internal/core/adtcache containsDefID results@mvdan992c1cd
  • internal/core/adtalways print errors in leaf nodes@mpvl8dce6dc
  • internal/cistop generating checksums.txt as a release archive@mvdan15e67c0
  • internal/core/adtturn Vertex.VisitAllConjuncts into an iterator@mvdan2536d4f
  • internal/core/...fully transition away from Vertex.VisitLeafConjuncts@mvdan40aa589
  • internal/core/adtavoid hang on self-references through "let"@mvdan85e008d
  • internal/core/adttest TopKind in TestKindString@mvdan42731c2
  • internal/core/adtadd the Vertex.LeafConjuncts iterator@mvdan2af8a20
  • internal/core/adtturn VisitConjuncts into ConjunctsSeq@mvdanb33320b
  • internal/mod/semverclean up with cmp.Compare@mvdana85df20
  • internal/encodingadd jsonschema as an output format@rogpeppe577c245
  • internal/encodingdo not require input to be concrete for concrete output formats@rogpeppe9305978
  • internal/encodingrefactor Encoder.Encode, Encoder.EncodeFile@rogpeppe93c27cc
  • internal/cuetxtardo not skip tests on Instance failure@rogpepped62b617

Other8

  • mod/modregistrymirror referrers in Client.Mirror@rogpeppef0d24a9
  • update all dependencies@mvdand4d62e6
  • tools/fixadd fixAliasAndSelf@mpvl2b281ea
  • cue/parser|format: implement postfix alias syntax@mpvl0eb7de7
  • lsp/definitionsfix broken build due to self renaming@cuematthew8df341b
  • switch this repository to cue.gerrithub.io@mvdan2a81d1e
  • Revert "mod/modregistry: mirror referrers in Client.Mirror"@mvdan6f47bbf
  • mod/modregistrymirror referrers in Client.Mirror@rogpeppe9b06b4c

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

PlatformFile and SHA-256
macOS, Intelcue_v0.15.0-alpha.3_darwin_amd64.tar.gz7ec9773fcd492b462748bb46c5aebf9e700971dbea66052971e6a79979a0e040
macOS, Apple siliconcue_v0.15.0-alpha.3_darwin_arm64.tar.gza9db87673b331aef9aa03a0cdedb571c50f0c4147989085d416b2c5da6f6c8a4
Linux, x86-64cue_v0.15.0-alpha.3_linux_amd64.tar.gze9be1c59c2bcb29c1f2c0dedbbc588b30c2e992777825dcfbd4b21042201da1c
Linux, Arm64cue_v0.15.0-alpha.3_linux_arm64.tar.gz487cf7af4bbc18d4b584b18484c8f0adeaa337ccac5b58d4f0c7a9fbe4addf8f
Windows, x86-64cue_v0.15.0-alpha.3_windows_amd64.zip669c0c5904f9df3a6632281b68b40d7b36a57fb7ebd3d5fab3e68b3fbad627e4
Windows, Arm64cue_v0.15.0-alpha.3_windows_arm64.zipbdb990bfa892f792851db5fd8e880917735ee7d6c5185e829cadfaf02f0bfa6b
Install CUE