Home

cuesonnet @main - refs - log -
-
https://git.jolheiser.com/cuesonnet.git
CUE + Jsonnet
drwxrwxrwx
36 B
cmd/
drwxrwxrwx
212 B
testdata/
-rw-r--r--
1.1 kB
LICENSE
-rw-r--r--
632 B
README.md
-rw-r--r--
1.4 kB
cuesonnet.go
-rw-r--r--
2.0 kB
cuesonnet_test.go
-rw-r--r--
692 B
go.mod
-rw-r--r--
5.3 kB
go.sum

cuesonnet

CUE + Jsonnet

Usage

Example Schema

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

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

License

MIT