       return dst
 
   validate:(spec,data,path=[],error_listener)=>
-    # console.log "validate",JSON.stringify(spec)
     error_listener ?= new ErrorReporter()
     valid = true
     path ?= []

        else
          @_emit_validation_error(error_listener,data,spec,'unexpected',path,v,k)

      # else
      #   if spec[k]?.constraints? and 'required' in v.constraints
      #     unless options?.ignore_errors
      #       @_emit_validation_error(error_listener,data,spec,'required',p,data)
      #     valid = false
    # for k,v of spec
    #   p = [].concat(path)
    #   p.push(k)
    #   if data?[k]?
    #     if not @_validate_attribute(v,data[k],p,error_listener)
    #       valid = false
    #   else
    #     if v?.constraints? and 'required' in v.constraints
    #       unless options?.ignore_errors
    #         @_emit_validation_error(error_listener,data,spec,'required',p,data)
    #       valid = false
    return valid

  _validate_attribute:(spec,attr,path,error_listener)=>
    # console.log "validate_attribute ",spec,spec?.datatype,JSON.stringify(attr)
    if Array.isArray(spec)
      error_collector = new ErrorCollector()
      for alt,i in spec
        # console.log "TESTING ALT #{i}",JSON.stringify(alt)
        if @_validate_attribute(alt,attr,path,error_collector)
          return true
      @_emit_validation_error(error_listener,attr,spec,'no-matching-alt',path,attr,error_collector.errors)

  else
    json_spec = new JSONSpec()
    spec = json_spec.load_spec process.argv[2]
    if process.argv.length >= 4
      data = Util.load_json_file_sync(process.argv[3])
    else
