github.com/solo-io/cue@v0.4.7/doc/tutorial/basics/0_intro/43_schema.txt (about) 1 cue export schema.cue 2 cmp stdout expect-stdout-cue 3 4 -- frontmatter.toml -- 5 title = "Definitions" 6 description = "" 7 8 -- text.md -- 9 In CUE, schemas are typically written as Definitions. 10 A definition is a field which identifier starts with 11 `#` or `_#`. 12 This tells CUE that they are to be used for validation and should 13 not be output as data; it is okay for them to remain unspecified. 14 15 A definition also tells CUE the full set of allowed fields. 16 In other words, definitions define "closed" structs. 17 Including a `...` in struct keeps it open. 18 19 -- schema.cue -- 20 #Conn: { 21 address: string 22 port: int 23 protocol: string 24 // ... // uncomment this to allow any field 25 } 26 27 lossy: #Conn & { 28 address: "1.2.3.4" 29 port: 8888 30 protocol: "udp" 31 // foo: 2 // uncomment this to get an error 32 } 33 34 -- expect-stdout-cue -- 35 { 36 "lossy": { 37 "address": "1.2.3.4", 38 "port": 8888, 39 "protocol": "udp" 40 } 41 }