Skip to content

Commit

Permalink
site: update latest CUE to v0.10.0
Browse files Browse the repository at this point in the history
And enable rendering of the `cue help embed` page.

Note that a number of jsonschema files are imported differently,
and we are also more strict about the schema version strings too.
The other changes are varied, including some CUE formatting fixes
and some changes to help texts.

Also note that this causes changes to the imported github-workflow
jsonschema as v0.10 includes a dozen changes to encoding/jsonschema.

DO NOT SUBMIT: to update once v0.10.0 is tagged.

Preprocessor-No-Write-Cache: true
Signed-off-by: Daniel Martí <[email protected]>
Change-Id: I74235f821e8df06d49553f02a0723a9847d8ecdc
Dispatch-Trailer: {"type":"trybot","CL":1199502,"patchset":2,"ref":"refs/changes/02/1199502/2","targetBranch":"master"}
  • Loading branch information
mvdan authored and cueckoo committed Aug 14, 2024
1 parent b9f0517 commit d32195b
Show file tree
Hide file tree
Showing 60 changed files with 479 additions and 288 deletions.
2 changes: 1 addition & 1 deletion content/docs/concept/cue-language-version/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ but in more recent CUE versions, this has been changed to:

{{{with code "en" "a2"}}}
-- in.cue --
let x = 5
let x = 5
{{{end}}}

If the language were never to be changed in a backwards incompatible
Expand Down
2 changes: 1 addition & 1 deletion content/docs/concept/how-cue-enables-data-validation/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ Let's include a JSON Schema file that adds some constraints to a couple of
{{{with upload "en" "schema.json"}}}
-- schema.json --
{
"$schema": "http://json-schema.org/draft-07/schema",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"ExampleType": {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion content/docs/concept/how-cue-works-with-json-schema/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ import "strings"
@jsonschema(schema="http://json-schema.org/draft-07/schema#")

// What is this person called?
name: strings.MinRunes(1)
name!: strings.MinRunes(1)

// Where does this person live?
address?: strings.MinRunes(1) & strings.MaxRunes(200)
Expand Down
4 changes: 2 additions & 2 deletions content/docs/concept/how-cue-works-with-openapi/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ info: {
// A Pet is a pet that we handle.
#Pet: {
// A pet has a name.
name: string
kind: #Kind
name!: string
kind!: #Kind

// Centenarian pets are not handled.
age?: int & >=0 & <100
Expand Down
4 changes: 2 additions & 2 deletions content/docs/howto/write-a-type-switch/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ output: [for v in input {
// Here, isANumber is implemented as a switch. Other, simpler,
// representations are also possible.
isANumber: [
if (v & number) != _|_ {true},
if (v & number) == _|_ {false},
if (v & number) != _|_ {true},
if (v & number) == _|_ {false},
][0]
}]
-- out --
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ definition.
name?: string
}
#Mammal: {
#Base// embedded
#Base // embedded
lungCapacityL: number
}
#Dog: {
#Mammal// embedded
#Mammal // embedded
kind!: "dog"
house: string
}
Expand Down
8 changes: 4 additions & 4 deletions content/docs/language-guide/templating/comprehensions/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ CUE has no switch or if-else construct, but these can be simulated using lists.

{{{with code "en" "switch-if-else-pattern"}}}
-- in.cue --
mem: 2Gi
mem: 2Gi
footprint: [// select first
if mem < 1Gi {"small"},
if mem < 4Gi {"medium"},
"large",
if mem < 1Gi {"small"},
if mem < 4Gi {"medium"},
"large",
][0]
-- out.cue --
mem: 2147483648
Expand Down
2 changes: 1 addition & 1 deletion content/docs/language-guide/templating/references/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ merging two maps.
{{{with code "en" "let-expressions"}}}
#norun open lists not implemented yet
-- in.cue --
let X = {list: []}
let X = {list: []}
a: X
b: X
c: X
Expand Down
3 changes: 1 addition & 2 deletions content/docs/reference/command/commands.cue
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ cue: {
commands: _
completion: _
def: _
// TODO: once CUE v0.10.0 is out, include `cue help embed`.
// embed: _
embed: _
environment: _
eval: _
export: _
Expand Down
12 changes: 12 additions & 0 deletions content/docs/reference/command/cue-help-embed/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
WARNING: "Code generated site_tool.cue; DO NOT EDIT."
title: "cue help embed"
aliases: ["/docs/reference/cli/cue-embed/"]
weight: 1000
tags:
- cue command
---

{{{with script "en" "cue cli help text"}}}
cue help embed
{{{end}}}
4 changes: 4 additions & 0 deletions content/docs/reference/command/cue-help-embed/page.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Code generated site_tool.cue; DO NOT EDIT.
package site

{"content":{"docs":{"reference":{"command":{"cue-help-embed":{"page":{}}}}}}}
7 changes: 6 additions & 1 deletion content/docs/reference/spec/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -2994,7 +2994,12 @@ PackageClause = "package" PackageName .
PackageName = identifier .
```

The PackageName must not be the blank identifier or a definition identifier.
The PackageName must not be a definition identifier.

If the PackageName is the blank identifier (`_`), it is treated the same
as if there were no package clause. This can be useful to allow adding
package level attributes or doc comments to a CUE file without a package
name.

```
package math
Expand Down
10 changes: 5 additions & 5 deletions content/docs/tutorial/converting-json-schema-to-cue/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ package cuisine

#restaurant: {
@jsonschema(schema="http://json-schema.org/draft-07/schema#")
name: string
cuisine: string
tables: [...#table]
name!: string
cuisine!: string
tables!: [...#table]

#table: {
seats: >=2 & <=10
view?: bool
seats!: >=2 & <=10
view?: bool
}
}
{{{end}}}
Expand Down
Loading

0 comments on commit d32195b

Please sign in to comment.