title: how to do proper for-loops in jsonnet?
body: <p>Each time I think I finally understood jsonnet, it comes around to hit me in the face ... -.-</p>
  <p>I have something like the following:</p>
  <pre><code>local applyModifications(kp) = {
    [topLvlKey]: {
      [subKey]: myfunction(kp[topLvlKey][subKey])
      for subKey in std.objectFieldsAll(kp[topLvlKey])
    },
    for topLvlKey in std.objectFieldsAll(kp)
  };
  </code></pre>
  <p>I want to iterate over everything inside the first 2 levels of an object an apply some function there ...</p>
  <p>Bascially that works ... But depending on if I use <code>std.objectFieldsAll</code> or <code>std.objectFields</code>, hidden fields are visible afterwards or missing completely.</p>
  <p>How would/could I do this without touching the hidden &quot;property&quot;?
  I understand my problem is, that I use a object-comprehension here and (to refer to an error message) that those &quot;Object comprehensions cannot have hidden fields&quot;...
  But as far as I understand jsonnet, something-comprehensions are the only way to create for-loops, right?</p>
  <p>Testcode:</p>
  <pre><code>// vim: set ts=2 sw=2 expandtab :
  local myfunction(o) = o {
    spec+: {
      foo: 'bar'
    }
  };
  
  local applyModifications(kp) = {
    [topLvlKey]: {
      [subKey]: myfunction(kp[topLvlKey][subKey])
      for subKey in std.objectFieldsAll(kp[topLvlKey])
    },
    for topLvlKey in std.objectFieldsAll(kp)
  };    
  
  local stack = {
    fooService: {
      fooResource: {
        kind: 'PrometheusRule',
        spec: {
          groups: [
            { name: 'fooGroup', rules: [{ alert: 'fooAlert', expr: 'fooExpr' }] },
            { name: 'barGroup', rules: [{ alert: 'fooAlert', expr: 'fooExpr' }] },
          ],
        },
      },
    },
    fooService2:: {
      fooResource: {
        kind: 'PrometheusRule',
        spec: {
          groups: [
            { name: 'fooGroup', rules: [{ alert: 'fooAlert', expr: 'fooExpr' }] },
            { name: 'barGroup', rules: [{ alert: 'fooAlert', expr: 'fooExpr' }] },
          ],
        },
      },
    },
  };
  
  local stack2 = applyModifications(stack);
     
  {
    modified: stack2 
  }
  </code></pre>