code: func parseService(svc *structs.ServiceQuery) error {
  	// Service is required.
  	if svc.Service == "" {
  		return fmt.Errorf("Must provide a Service name to query")
  	}
  
  	// NearestN can be 0 which means "don't fail over by RTT".
  	if svc.Failover.NearestN < 0 {
  		return fmt.Errorf("Bad NearestN '%d', must be >= 0", svc.Failover.NearestN)
  	}
  
  	// Make sure the metadata filters are valid
  	if err := structs.ValidateMetadata(svc.NodeMeta, true); err != nil {
  		return err
  	}
  
  	// We skip a few fields:
  	// - There's no validation for Datacenters; we skip any unknown entries
  	//   at execution time.
  	// - OnlyPassing is just a boolean so doesn't need further validation.
  	// - Tags is a free-form list of tags and doesn't need further validation.
  
  	return nil
  }
docs: // parseService makes sure the entries of a query are valid for a create or
  // update operation. Some of the fields are not checked or are partially
  // checked, as noted in the comments below. This also updates all the parsed
  // fields of the query.