v0.2.1

cue-lang/cue Released

A release of CUE OSS · its page on GitHub

Disabling of previously deprecated language features

The new evaluator will no longer support some of the legacy syntax. Also, it will adopt JSON Schema semantics for bulk optional fields (to be called pattern constraints) and will have more flexible semantics for ellipsis to allow encoding “additionalConstraints” more easily.

To allow for a smooth transition, this release disables the older deprecated semantics and syntax to remind people to run cue fix to upgrade their configurations, as cue fix won’t work for these deprecated features once the new evaluator comes around.

API changes

To facilitate moving the API as well, LookupDef now automatically adds a # prefix if a field cannot be found and is not a valid definition in the new syntax. This is an unambiguous addition.

JSON Schema and OpenAPI fixes

Exclusive minimum and maximum legacy support

The current OpenAPI implementation used the current JSON Schema semantics for representing exclusive minima and maxima. OpenAPI v3.0.0, however, mandates the use of the deprecated encoding. The OpenAPI generator now generates such constraints using the legacy syntax. The OpenAPI generation API now has a Version field that allows enabling the new behavior if set to 3.1.0.

As for now, the JSON schema reader will accept the legacy encoding unconditionally in addition to accepting the standard encoding.

$ref changes

OpenAPI defines that a$ref replaces all other fields in a schema. The JSON Schema RFC seems to allow at least some fields to be alongside $ref and there are some side comment notes that seem to imply that this is explicitly allowed. In order to avoid any confusion, however, $ref is now wrapped in an allOf if it may otherwise cause a conflict.

JSON Schema model fixing for mixed type fields

The original JSON Schema made the erroneous assumption that a constraint for a certain type implies that the value must be of this type. This is not the case. So

type: [string, integer]
minimum: 3
maxLengh: 4

will now be encoded as

strings.MaxRunes(4) | (int & >=3)

cue get go

The cue get go tool now also converts Go constraints encoding the field tags. This bring is in line with the API converters.

The tool now also has a --local flag to allow generating files in the Go package directory, rather than the corresponding cue.mod/gen subdirectory. This is not set to the default as to not break existing behavior.

All changes

23 changesby area

ci3

  • cifix vendor path of GitHub workflow definitions78cc785
  • cionly run gorelease check on latest versions of Goc47316f
  • cire-add Go 1.12.x to the build matrix2f69bfa

cue5

  • cue/ast/astutiladd Expr to File conversion (ToFile)8bfdfe3
  • cue/astdon't require ellipsis to be at end of struct.f5315d4
  • cue/astintroduce NewNull()197f4c8
  • cueallow omitting leading "#" for LookupDef53d18cc
  • cuedeprecate :: and combining bulk optional fields with other fields7efeb70

encoding6

  • encoding/gocodecValidate helper functioncb21170
  • encoding/jsonschemaadd support for OpenAPI nullable7aa2eb7
  • encoding/jsonschemaconstraints don't imply typesa91b869
  • encoding/jsonschemafix printing of error messageeb7706b
  • encoding/jsonschemarecord more line information91d267a
  • encoding/openapiwrap $ref in allOf when needed.50b9067

Other9

  • .githubdisable generation of schemaddc8eb4
  • allupdate most tests to not use ::083afe7
  • cmd/cue/cmdextract cue constraints in tags in get go019060d
  • cmd/cue/cmdget go: import files to cue module if in main module4d31efd
  • encoding/openapi|jsonschema: allow bool for exclusiveNum2a8b4ed
  • go.moduse github.com/rogpeppe/go-internal/testscript3e62450
  • internal/encodingdon't simplify interpreted encodings519db58
  • pkg/listremove use of :: (Incompatible!!!)1d213a3
  • tools/fixmove fix functionality to separate package5515ee9

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_0.2.1_Darwin_x86_64.tar.gz2b2038feaa2732f25bfb8c563627f990fa890bc654acee34c915bafa5279bc04
Linux, Arm64cue_0.2.1_Linux_arm64.tar.gz66986314a9c4c160544f54b8b4a30eb5b9d3418ed444711951026e629f4ef9e7
Linux, x86-64cue_0.2.1_Linux_x86_64.tar.gz40078d02559595eec8e5a873f09ca89545502019bcac6f892f5a30bb8d49286c
Windows, x86-64cue_0.2.1_Windows_x86_64.zipb705cd47d3d568b231ed94c8d3e947f9e1d9b54eab0483d9a00b1c6645be32e9

SHA-256 checksums for all of these: checksums.txt

Install CUE