// This method assumes following fields have been assigned with valid values:
// Required - Poster, Issue
340219
func (c *Comment) APIFormat() *api.Comment {
	return &api.Comment{
		ID:      c.ID,
		HTMLURL: c.HTMLURL(),
		Poster:  c.Poster.APIFormat(),
		Body:    c.Content,
		Created: c.Created,
		Updated: c.Updated,
	}
}
982501
func (js *JSONSchema) PostUnmarshal() {
	for name, prop := range js.Properties {
		prop.Required = js.isRequired(name)
		js.Properties[name] = prop
	}
}
1282399
func (v *IntIsPresent) IsValid(errors *validate.Errors) {
	if v.Field != 0 {
		return
	}

	if len(v.Message) > 0 {
		errors.Add(GenerateKey(v.Name), v.Message)
		return
	}

	errors.Add(GenerateKey(v.Name), fmt.Sprintf("%s can not be blank.", v.Name))
}
741378
func (e HeaderMapValidationError) Error() string {
	cause := ""
	if e.cause != nil {
		cause = fmt.Sprintf(" | caused by: %v", e.cause)
	}

	key := ""
	if e.key {
		key = "key for "
	}

	return fmt.Sprintf(
		"invalid %sHeaderMap.%s: %s%s",
		key,
		e.field,
		e.reason,
		cause)
}
1350947
func (req *Request) PostFormValue(key string) (value string) {
	valueList := req.controller.Params.Form[key]
	if len(valueList) > 0 {
		value = valueList[0]
	}
	return
}
1356457
func (v *Validation) Valid(obj interface{}, args ...string) (ok bool, err error) {
	err = v.validExec(obj, "", args...)
	if err != nil {
		fmt.Println(err)
		return
	}
	if !v.HasErrors() {
		if form, ok := obj.(ValidFormer); ok {
			form.Valid(v)
		}
	}
	ok = v.HasErrors() == false
	return
}
1271334
func ValidatePositiveInteger(value interface{}) error {
	if v, err := stringutil.ConvertToInteger(value); err == nil {
		if v <= 0 {
			return fmt.Errorf("expected value > 0, got: %v", v)
		}
	} else {
		return err
	}

	return nil
}
563415
func ValidateHasLabel(meta api.ObjectMeta, fldPath *field.Path, key, expectedValue string) field.ErrorList {
	allErrs := field.ErrorList{}
	actualValue, found := meta.Labels[key]
	if !found {
		allErrs = append(allErrs, field.Required(fldPath.Child("labels"), key+"="+expectedValue))
		return allErrs
	}
	if actualValue != expectedValue {
		allErrs = append(allErrs, field.Invalid(fldPath.Child("labels"), meta.Labels, "expected "+key+"="+expectedValue))
	}
	return allErrs
}
111463
func Required() Predicate {
	return PredicateFunc(func(param string, r *http.Request) error {
		if r.Form.Get(param) == "" {
			return &MissingParameterError{Param: param}
		}
		return nil
	})
}
591159
func (c *Context) PostFormMap(key string) map[string]string {
	dicts, _ := c.GetPostFormMap(key)
	return dicts
}
664773
func (ref *Consumer) PrintNotification(note map[string][]int32) {
	for k, v := range note {
		fmt.Printf("  Topic: %s\n", k)
		fmt.Printf("    Partitions: %v\n", v)
	}
}
702535
func (r *rulesetUI) OnInputRequired(info core.UserInputRequest) (core.UserInputResponse, error) {
	return r.next.OnInputRequired(info)
}
1128884
func (env *Zlisp) PostfixAssign(op string, bp int) *InfixOp {
	oper := env.MakeSymbol(op)
	iop := &InfixOp{
		Sym: oper,
		Bp:  bp,
		MunchLeft: func(env *Zlisp, pr *Pratt, left Sexp) (Sexp, error) {
			// TODO: check that left is okay as an LVALUE
			list := MakeList([]Sexp{
				oper, left,
			})
			Q("postfix assignment returning list: '%v'", list.SexpString(nil))
			return list, nil
		},
	}
	env.infixOps[op] = iop
	return iop
}
340724
func (ctx *context) PostValueInt(name string) (int, error) {
	v := ctx.PostValue(name)
	if v == "" {
		return -1, errUnableToFindPostValue.Format(name)
	}
	return strconv.Atoi(v)
}
227298
func isRequired(field *descriptor.FieldDescriptorProto) bool {
	return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REQUIRED
}
435707
func (p *PrometheusReporter) ensureLabels(labels map[string]string) map[string]string {
	for key, defaultVal := range p.additionalLabels {
		if _, ok := labels[key]; !ok {
			labels[key] = defaultVal
		}
	}

	return labels
}
495581
func validateRequired(v interface{}, name string) error {
	if v == nil {
		return ErrRequired
	}
	return validateNonEmpty(v, name)
}