// validateRequired implements the `required` validation tag.
// If a field is required, it must be present in the config.
// If field is a string, regex or slice its length must be > 0.
495581
func validateRequired(v interface{}, name string) error {
	if v == nil {
		return ErrRequired
	}
	return validateNonEmpty(v, name)
}
658505
func ValidateNotEmpty(value interface{}) error {
	if typeutil.IsEmpty(value) {
		return fmt.Errorf("expected non-empty value, got: %v", value)
	}

	return nil
}
416579
func LengthRequired(w http.ResponseWriter, response interface{}) {
	Respond(w, http.StatusLengthRequired, response)
}
687526
func (d multiValidator) MustValidate(s interface{}) {
	if err := d.Validate(s); err != nil {
		panic(err)
	}
}
370099
func NewErrParamRequired(field string) *ErrParamRequired {
	return &ErrParamRequired{
		errInvalidParam{
			code:  ParamRequiredErrCode,
			field: field,
			msg:   fmt.Sprintf("missing required field"),
		},
	}
}
171067
func (s StringStringMap) GetRequiredString(key string) (string, error) {
	value, ok := s[key]
	if !ok {
		return "", newRequiredError(key)
	}
	return value, nil
}
881799
func (c *Config) GetRequired(key string) Value {
	val, err := c.Get(key)
	if err != nil {
		configErrorf("Configuration parameter %s is mandatory", key)
	}
	return val
}
711271
func (r fieldRequiredness) isRequired(src *ast.Field) (bool, error) {
	switch r {
	case explicitRequiredness:
		if src.Requiredness == ast.Unspecified {
			return false, requirednessRequiredError{
				FieldName: src.Name,
				Line:      src.Line,
			}
		}
	case noRequiredFields:
		if src.Requiredness == ast.Required {
			return false, cannotBeRequiredError{
				FieldName: src.Name,
				Line:      src.Line,
			}
		}
	default:
		// do nothing
	}

	// A field is considered required only if it was marked required AND it
	// does not have a default value.
	return (src.Requiredness == ast.Required && src.Default == nil), nil
}
779856
func checkRequiredFlags(ctx *cli.Context) error {
	missing := []string{}
	for _, f := range ctx.Command.Flags {
		var name string
		flagMissing := false
		switch pf := f.(type) {
		case placeHolderStringFlag:
			name = strings.SplitN(pf.GetName(), ",", 2)[0]
			if pf.Required && ctx.String(name) == "" {
				flagMissing = true
			}
		case placeHolderStringSliceFlag:
			name = strings.SplitN(pf.GetName(), ",", 2)[0]
			if pf.Required && len(ctx.StringSlice(name)) == 0 {
				flagMissing = true
			}

		}
		if flagMissing {
			prefix := "-"
			if len(name) > 1 {
				prefix = "--"
			}
			missing = append(missing, prefix+name)
		}

	}

	if len(missing) > 0 {
		msg := "Missing flags: " + strings.Join(missing, ", ")
		return errs.NewUsageExitError(msg, ctx)
	}

	return nil
}
813126
func (v *Validation) Validate(i interface{}, args ...string) ValidateResult {
	e := NewValidateResult()
	var err error
	switch m := i.(type) {
	case string:
		field := m
		var value, rule string
		switch len(args) {
		case 2:
			rule = args[1]
			fallthrough
		case 1:
			value = args[0]
		}
		if len(rule) == 0 {
			return e
		}
		_, err = v.validator.ValidSimple(field, value, rule)
	default:
		_, err = v.validator.Valid(i, args...)
	}
	if err != nil {
		return e.SetError(err)
	}
	if v.validator.HasError() {
		vErr := v.validator.Errors[0]
		e.SetError(vErr)
		e.SetField(vErr.Field)
		e.SetRaw(v.validator.Errors)
		v.validator.Errors = nil
	}
	return e
}
28894
func NewRequire(Expression node.Node) *Require {
	return &Require{
		FreeFloating: nil,
		Expr:         Expression,
	}
}
568643
public static boolean validateRequiredField(String field, String reg) {
        return !(field == null || field.isEmpty()) && Pattern.matches(reg, field);
    }
1019884
func (v *Validation) Required(obj interface{}, key string) *ValidationResult {
	return v.apply(Required{key}, obj)
}
956025
func (s *SdkConfigurationProperty) SetRequired(v bool) *SdkConfigurationProperty {
	s.Required = &v
	return s
}
20334
func (v *requiredRule) Validate(value interface{}) error {
	value, isNil := Indirect(value)
	if v.skipNil && !isNil && IsEmpty(value) || !v.skipNil && (isNil || IsEmpty(value)) {
		return errors.New(v.message)
	}
	return nil
}
1097610
func RequiredValidator(input string) (interface{}, error) {
	if input == "" {
		return nil, fmt.Errorf("This option is required")
	}

	return input, nil
}
1233812
func (c *Client) AuthenticationRequired() bool {
	return c.authentication.AccessToken == "" || c.authentication.ExpiresAt <= time.Now().Unix()
}