v0.2.1
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: 4will 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 definitionscionly run gorelease check on latest versions of Gocire-add Go 1.12.x to the build matrix
cue5
cue/ast/astutiladd Expr to File conversion (ToFile)cue/astdon't require ellipsis to be at end of struct.cue/astintroduce NewNull()cueallow omitting leading "#" for LookupDefcuedeprecate :: and combining bulk optional fields with other fields
encoding6
encoding/gocodecValidate helper functionencoding/jsonschemaadd support for OpenAPI nullableencoding/jsonschemaconstraints don't imply typesencoding/jsonschemafix printing of error messageencoding/jsonschemarecord more line informationencoding/openapiwrap $ref in allOf when needed.
Other9
.githubdisable generation of schemaallupdate most tests to not use::cmd/cue/cmdextract cue constraints in tags in get gocmd/cue/cmdget go: import files to cue module if in main module- encoding/openapi|jsonschema: allow bool for exclusiveNum
go.moduse github.com/rogpeppe/go-internal/testscriptinternal/encodingdon't simplify interpreted encodingspkg/listremove use of::(Incompatible!!!)tools/fixmove fix functionality to separate package
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_2b2038feaa2732f25bfb8c563627f990fa890bc654acee34c915bafa5279bc04 |
| Linux, Arm64 | cue_66986314a9c4c160544f54b8b4a30eb5b9d3418ed444711951026e629f4ef9e7 |
| Linux, x86-64 | cue_40078d02559595eec8e5a873f09ca89545502019bcac6f892f5a30bb8d49286c |
| Windows, x86-64 | cue_b705cd47d3d568b231ed94c8d3e947f9e1d9b54eab0483d9a00b1c6645be32e9 |
SHA-256 checksums for all of these: checksums.txt