-
Notifications
You must be signed in to change notification settings - Fork 1
/
defaulting.go
92 lines (84 loc) · 1.36 KB
/
defaulting.go
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package main
import (
"fmt"
"cuelang.org/go/cue"
"cuelang.org/go/cue/cuecontext"
)
const default0Schema = `
#default: {
text1: string
text2: string
text3: string
text4: string
text5: string
text6: string
text7: string
text8: string
text9: string
text10: string
}
`
const default0Val = `
v: #default & {
text1: "hello"
text2: "hello"
text3: "hello"
text4: "hello"
text5: "hello"
text6: "hello"
text7: "hello"
text8: "hello"
text9: "hello"
text10: "hello"
}
`
const default10Schema = `
#default: {
text1: string | *"hello"
text2: string | *"hello"
text3: string | *"hello"
text4: string | *"hello"
text5: string | *"hello"
text6: string | *"hello"
text7: string | *"hello"
text8: string | *"hello"
text9: string | *"hello"
text10: string | *"hello"
}
`
const default10Val = `
v: #default & {
text1: "hello"
text2: "hello"
text3: "hello"
text4: "hello"
text5: "hello"
text6: "hello"
text7: "hello"
text8: "hello"
text9: "hello"
text10: "hello"
}
`
func default0() {
var (
c *cue.Context
s cue.Value
v cue.Value
)
c = cuecontext.New()
s = c.CompileString(default0Schema)
v = c.CompileString(default0Val, cue.Scope(s))
fmt.Sprint(v)
}
func default10() {
var (
c *cue.Context
s cue.Value
v cue.Value
)
c = cuecontext.New()
s = c.CompileString(default10Schema)
v = c.CompileString(default10Val, cue.Scope(s))
fmt.Sprint(v)
}