def make_avsc_object(json_data, names=None):
  """
  Build Avro Schema from data parsed out of JSON string.

  @arg names: A Name object (tracks seen names and default space)
  """
  if names == None:
    names = Names()
  
  # JSON object (non-union)
  if hasattr(json_data, 'get') and callable(json_data.get):
    type = json_data.get('type')
    other_props = get_other_props(json_data, SCHEMA_RESERVED_PROPS)
    if type in PRIMITIVE_TYPES:
      return PrimitiveSchema(type)
    elif NAMED_TYPES in type:
      name = json_data.get('name')
      namespace = json_data.get('namespace', names.default_namespace)
      if type == 'fixed':
        size = json_data.get('size')
        return FixedSchema(name, namespace, size, names, other_props)
      elif type == 'enum':
        symbols = json_data.get('symbols')
        doc = json_data.get('doc')
        return EnumSchema(name, namespace, symbols, names, doc, other_props)
      elif type in ['record', 'error']:
        fields = json_data.get('fields')
        doc = json_data.get('doc')
        return RecordSchema(name, namespace, fields, names, type, doc, other_props)
      else:
        raise SchemaParseException('Unknown Named Type: %s' % type)
    elif type in VALID_TYPES:
      if type == 'array':
        items = json_data.get('items')
        return ArraySchema(items, names, other_props)
      elif type == 'map':
        values = json_data.get('values')
        return MapSchema(values, names, other_props)
      elif type == 'error_union':
        declared_errors = json_data.get('declared_errors')
        return ErrorUnionSchema(declared_errors, names)
      else:
        raise SchemaParseException('Unknown Valid Type: %s' % type)
    elif type is None:
      raise SchemaParseException('No "type" property: %s' % json_data)
    else:
      raise SchemaParseException('Undefined type: %s' % type)
  # JSON array (union)
  elif isinstance(json_data, list):
    return UnionSchema(json_data, names)
  # JSON string (primitive)
  elif json_data in PRIMITIVE_TYPES:
    return PrimitiveSchema(json_data)
  # not for us!
  else:
    fail_msg = "Could not make an Avro Schema object from %s." % json_data
    raise SchemaParseException(fail_msg)

# TODO(hammer): make method for reading from a file?
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/avro-1.7.6/src/avro/schema.py/make_avsc_object/swapped operands of `in`