Home

cuesonnet @719813b3cbd2b081b36d1eb99a21972fa7f9a1e7 - refs - log -
-
https://git.jolheiser.com/cuesonnet.git
CUE + Jsonnet
cuesonnet / README.md
- raw -
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# cuesonnet

CUE + Jsonnet

## Usage

[Example Schema](testdata/schema.cue)

```cue
import "time"

#Schema: {
	// Basic schema
	firstName: string
	lastName:  string
	age:       int
	birthday:  string

	// Refine as needed
	#Title:    =~"^[A-Z]" | error("must start with an uppercase letter")
	firstName: #Title
	lastName:  #Title
	age:       >0
	birthday:  time.Format("01/02/2006")

	// Defaults
	gopher: bool | *true
}

// Apply the schema to root
#Schema
```

[Example Jsonnet](testdata/fixed.jsonnet)

```jsonnet
{
  firstName: 'Jim',
  lastName: 'Jimbly',
  age: 45,
  birthday: '01/02/2003',
}
```

## License

[MIT](LICENSE)