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

     1  -- in.cue --
     2  #simple: {
     3    peso: *1|int
     4    edad: *2|int
     5  }
     6  
     7  // Second struct is not considered closed, as expected
     8  good: #simple & {
     9    peso: 4
    10  }
    11  
    12  
    13  #complex: {
    14    things: [string]: #simple
    15  }
    16  
    17  // Still, no closedness issue in the second struct
    18  #many: #complex & {
    19    things: hola: peso: 2
    20    things: sol: peso: 3
    21  }
    22  
    23  // Inner struct in second struct IS considered closed: why?
    24  bad: #many  & {
    25    things: hola: peso: 2
    26  }
    27  
    28  // non-definition equivalent
    29  many: #complex & {
    30    things: hola: peso: 2
    31    things: sol: peso: 3
    32  }
    33  
    34  // Now inner struct on second struct is NOT considered closed
    35  notbad: many  & {
    36    things: hola: peso: 2
    37  }
    38  -- out/eval --
    39  (struct){
    40    #simple: (#struct){
    41      peso: (int){ |(*(int){ 1 }, (int){ int }) }
    42      edad: (int){ |(*(int){ 2 }, (int){ int }) }
    43    }
    44    good: (#struct){
    45      peso: (int){ 4 }
    46      edad: (int){ |(*(int){ 2 }, (int){ int }) }
    47    }
    48    #complex: (#struct){
    49      things: (#struct){
    50      }
    51    }
    52    #many: (#struct){
    53      things: (#struct){
    54        hola: (#struct){
    55          peso: (int){ 2 }
    56          edad: (int){ |(*(int){ 2 }, (int){ int }) }
    57        }
    58        sol: (#struct){
    59          peso: (int){ 3 }
    60          edad: (int){ |(*(int){ 2 }, (int){ int }) }
    61        }
    62      }
    63    }
    64    bad: (#struct){
    65      things: (#struct){
    66        hola: (#struct){
    67          peso: (int){ 2 }
    68          edad: (int){ |(*(int){ 2 }, (int){ int }) }
    69        }
    70        sol: (#struct){
    71          peso: (int){ 3 }
    72          edad: (int){ |(*(int){ 2 }, (int){ int }) }
    73        }
    74      }
    75    }
    76    many: (#struct){
    77      things: (#struct){
    78        hola: (#struct){
    79          peso: (int){ 2 }
    80          edad: (int){ |(*(int){ 2 }, (int){ int }) }
    81        }
    82        sol: (#struct){
    83          peso: (int){ 3 }
    84          edad: (int){ |(*(int){ 2 }, (int){ int }) }
    85        }
    86      }
    87    }
    88    notbad: (#struct){
    89      things: (#struct){
    90        hola: (#struct){
    91          peso: (int){ 2 }
    92          edad: (int){ |(*(int){ 2 }, (int){ int }) }
    93        }
    94        sol: (#struct){
    95          peso: (int){ 3 }
    96          edad: (int){ |(*(int){ 2 }, (int){ int }) }
    97        }
    98      }
    99    }
   100  }
   101  -- out/compile --
   102  --- in.cue
   103  {
   104    #simple: {
   105      peso: (*1|int)
   106      edad: (*2|int)
   107    }
   108    good: (〈0;#simple〉 & {
   109      peso: 4
   110    })
   111    #complex: {
   112      things: {
   113        [string]: 〈2;#simple〉
   114      }
   115    }
   116    #many: (〈0;#complex〉 & {
   117      things: {
   118        hola: {
   119          peso: 2
   120        }
   121      }
   122      things: {
   123        sol: {
   124          peso: 3
   125        }
   126      }
   127    })
   128    bad: (〈0;#many〉 & {
   129      things: {
   130        hola: {
   131          peso: 2
   132        }
   133      }
   134    })
   135    many: (〈0;#complex〉 & {
   136      things: {
   137        hola: {
   138          peso: 2
   139        }
   140      }
   141      things: {
   142        sol: {
   143          peso: 3
   144        }
   145      }
   146    })
   147    notbad: (〈0;many〉 & {
   148      things: {
   149        hola: {
   150          peso: 2
   151        }
   152      }
   153    })
   154  }