github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/tools/trim/testdata/optional.txtar (about)

     1  // Optional fields should retain status after removal of unified
     2  // content.
     3  
     4  // Issue #855
     5  
     6  -- cue.mod/module.cue --
     7  module: "mod.com"
     8  -- a.cue --
     9  package pkg
    10  
    11  a: [...#A]
    12  
    13  a: [{
    14  	annotations: {}
    15  }]
    16  
    17  #A: annotations?: [string]: string
    18  
    19  b: #B
    20  b: bb: c:   2 // c can be removed, bb not.
    21  #B: bb?: c: 2
    22  -- out/trim --
    23  == a.cue
    24  package pkg
    25  
    26  a: [...#A]
    27  
    28  a: [{
    29  	annotations: {}
    30  }]
    31  
    32  #A: annotations?: [string]: string
    33  
    34  b:        #B
    35  b: bb: {} // c can be removed, bb not.
    36  #B: bb?: c: 2