github.com/solo-io/cue@v0.4.7/cue/testdata/definitions/issue320.txtar (about)

     1  -- in.cue --
     2  #Foo: {
     3  	x: string
     4  	#More
     5  }
     6  
     7  #More: [=~ "^x-"]: _
     8  
     9  foo: #Foo & {
    10  	x: "hello"
    11  	y: "goodbye"
    12  }
    13  -- out/eval --
    14  Errors:
    15  foo: field not allowed: y:
    16      ./in.cue:1:7
    17      ./in.cue:3:2
    18      ./in.cue:6:8
    19      ./in.cue:8:6
    20      ./in.cue:10:2
    21  
    22  Result:
    23  (_|_){
    24    // [eval]
    25    #Foo: (#struct){
    26      x: (string){ string }
    27    }
    28    #More: (#struct){
    29    }
    30    foo: (_|_){
    31      // [eval]
    32      x: (string){ "hello" }
    33      y: (_|_){
    34        // [eval] foo: field not allowed: y:
    35        //     ./in.cue:1:7
    36        //     ./in.cue:3:2
    37        //     ./in.cue:6:8
    38        //     ./in.cue:8:6
    39        //     ./in.cue:10:2
    40      }
    41    }
    42  }
    43  -- out/compile --
    44  --- in.cue
    45  {
    46    #Foo: {
    47      x: string
    48      〈1;#More〉
    49    }
    50    #More: {
    51      [=~"^x-"]: _
    52    }
    53    foo: (〈0;#Foo〉 & {
    54      x: "hello"
    55      y: "goodbye"
    56    })
    57  }