code: func (o *PetUploadImageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
  
  	if err := r.SetTimeout(o.timeout); err != nil {
  		return err
  	}
  	var res []error
  
  	if o.AdditionalMetadata != nil {
  
  		// form param additionalMetadata
  		var frAdditionalMetadata string
  		if o.AdditionalMetadata != nil {
  			frAdditionalMetadata = *o.AdditionalMetadata
  		}
  		fAdditionalMetadata := frAdditionalMetadata
  		if fAdditionalMetadata != "" {
  			if err := r.SetFormParam("additionalMetadata", fAdditionalMetadata); err != nil {
  				return err
  			}
  		}
  
  	}
  
  	if o.File != nil {
  
  		if o.File != nil {
  
  			// form file param file
  			if err := r.SetFileParam("file", o.File); err != nil {
  				return err
  			}
  
  		}
  
  	}
  
  	// path param petId
  	if err := r.SetPathParam("petId", swag.FormatInt64(o.PetID)); err != nil {
  		return err
  	}
  
  	if len(res) > 0 {
  		return errors.CompositeValidationError(res...)
  	}
  	return nil
  }
docs: // WriteToRequest writes these params to a swagger request