code: func (o *object) generate(dir string) error {
  	o.handleAdvancedType()
  
  	// generate enums
  	for _, f := range o.Fields {
  		if f.Enum != nil {
  			if err := f.Enum.generate(dir); err != nil {
  				return err
  			}
  		}
  	}
  
  	if o.Enum != nil {
  		return o.Enum.generate(dir)
  	}
  	filename := filepath.Join(dir, o.Name()+".nim")
  	if err := commons.GenerateFile(o, "./templates/nim/object_nim.tmpl", "object_nim", filename, true); err != nil {
  		return err
  	}
  	return nil
  }
docs: // generate nim object representation