resolveTypes method

void resolveTypes(
  1. VlJson encoding
)

Implementation

void resolveTypes(VlJson encoding) {
  for ( int ki = 0; ki < encoding.keys.length; ki++) {
    var k = encoding.keys[ki];
    VlJson ch = encoding._get(k);
    if ( ch.isArray() ) {
      int i = 0;
      int n = ch.count();
      while (i < n) {
        VlJson one = ch.at(i);
        if ( one.isObject() ) {
          if ( false == one.has("type") ) {
            String listKind = this.inferType(one);
            if ( listKind.length > 0 ) {
              one.setMember("type", VlJson.stringValue(listKind));
            }
          }
        }
        i = i + 1;
      }
    }
    if ( ch.isObject() ) {
      if ( false == ch.has("type") ) {
        if ( false == ch.has("value") ) {
          String kind = this.inferType(ch);
          if ( kind.length > 0 ) {
            ch.setMember("type", VlJson.stringValue(kind));
          }
        }
      }
    }
  }
}