Github user jbapple-cloudera commented on the issue:

    https://github.com/apache/thrift/pull/1222
  
    How about
    
    ```
    void t_json_generator::write_type_spec(t_type* ttype) {
      ttype = ttype->get_true_type();
    
      write_string(get_type_name(ttype));
    
      if (ttype->is_struct() || ttype->is_xception()) {
        write_key_and_string("class", get_qualified_name(ttype));
        return;
      }
    
      if (ttype->is_map()) {
        t_type* ktype = ((t_map*)ttype)->get_key_type();
        t_type* vtype = ((t_map*)ttype)->get_val_type();
        write_key_and_string("keyTypeId", get_type_name(ktype));
        write_key_and_string("valueTypeId", get_type_name(vtype));
        write_type_spec_object("keyType", ktype);
        write_type_spec_object("valueType", vtype);
        return;
      }
    
      t_type* etype = NULL;
      if (ttype->is_list()) {
        etype = ((t_list*)ttype)->get_elem_type();
      } else if (ttype->is_set()) {
        etype = ((t_set*)ttype)->get_elem_type();
      }
    
      if( etype != NULL) {
        write_key_and_string("elemTypeId", get_type_name(etype));
        write_type_spec_object("elemType", etype);
      }
    }
    ```
    
    Another alternative is to do what your other patch is doing and have 
`t_set` and `t_list` inherit from a base type that has a `get_elem_type()` 
virtual method.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to