func (m *RepositoryBuildRequest) validateDockerTags(formats strfmt.Registry) error {

	if swag.IsZero(m.DockerTags) { // not required
		return nil
	}

	iDockerTagsSize := int64(len(m.DockerTags))

	if err := validate.MinItems("docker_tags", "body", iDockerTagsSize, 1); err != nil {
		return err
	}

	if err := validate.UniqueItems("docker_tags", "body", m.DockerTags); err != nil {
		return err
	}

	for i := 0; i < len(m.DockerTags); i++ {

		if err := validate.RequiredString("docker_tags"+"."+strconv.Itoa(i), "body", string(m.DockerTags[i])); err != nil {
			return err
		}

	}

	return nil
}
示例#2
0
文件: task_card.go 项目: vmware/vic
func (m *TaskCard) validateTags(formats strfmt.Registry) error {

	if swag.IsZero(m.Tags) { // not required
		return nil
	}

	iTagsSize := int64(len(m.Tags))

	if err := validate.MaxItems("tags", "body", iTagsSize, 5); err != nil {
		return err
	}

	if err := validate.UniqueItems("tags", "body", m.Tags); err != nil {
		return err
	}

	for i := 0; i < len(m.Tags); i++ {

		if err := validate.RequiredString("tags"+"."+strconv.Itoa(i), "body", string(m.Tags[i])); err != nil {
			return err
		}

		if err := validate.MinLength("tags"+"."+strconv.Itoa(i), "body", string(m.Tags[i]), 3); err != nil {
			return err
		}

		if err := validate.Pattern("tags"+"."+strconv.Itoa(i), "body", string(m.Tags[i]), `\w[\w- ]+`); err != nil {
			return err
		}

	}

	return nil
}
示例#3
0
func (s *stringValidator) Validate(val interface{}) *Result {
	data := val.(string)

	if s.Required && (s.Default == nil || s.Default == "") {
		if err := validate.RequiredString(s.Path, s.In, data); err != nil {
			return sErr(err)
		}
	}

	if s.MaxLength != nil {
		if err := validate.MaxLength(s.Path, s.In, data, *s.MaxLength); err != nil {
			return sErr(err)
		}
	}

	if s.MinLength != nil {
		if err := validate.MinLength(s.Path, s.In, data, *s.MinLength); err != nil {
			return sErr(err)
		}
	}

	if s.Pattern != "" {
		if err := validate.Pattern(s.Path, s.In, data, s.Pattern); err != nil {
			return sErr(err)
		}
	}
	return nil
}
示例#4
0
func (m *NewUser) validateUsername(formats strfmt.Registry) error {

	if err := validate.RequiredString("username", "body", string(m.Username)); err != nil {
		return err
	}

	return nil
}
示例#5
0
func (m *NewUser) validatePassword(formats strfmt.Registry) error {

	if err := validate.RequiredString("password", "body", string(m.Password)); err != nil {
		return err
	}

	return nil
}
示例#6
0
func (m *NewUser) validateEmail(formats strfmt.Registry) error {

	if err := validate.RequiredString("email", "body", string(m.Email)); err != nil {
		return err
	}

	return nil
}
示例#7
0
func (m *Comment) validateContent(formats strfmt.Registry) error {

	if err := validate.RequiredString("content", "body", string(m.Content)); err != nil {
		return err
	}

	return nil
}
示例#8
0
func (m *NewRepo) validateRepository(formats strfmt.Registry) error {

	if err := validate.RequiredString("repository", "body", string(m.Repository)); err != nil {
		return err
	}

	return nil
}
示例#9
0
func (m *Event) validateID(formats strfmt.Registry) error {

	if err := validate.RequiredString("id", "body", string(m.ID)); err != nil {
		return err
	}

	return nil
}
示例#10
0
func (m *UpdateApp) validateRedirectURI(formats strfmt.Registry) error {

	if err := validate.RequiredString("redirect_uri", "body", string(m.RedirectURI)); err != nil {
		return err
	}

	return nil
}
示例#11
0
func (m *UpdateApp) validateApplicationURI(formats strfmt.Registry) error {

	if err := validate.RequiredString("application_uri", "body", string(m.ApplicationURI)); err != nil {
		return err
	}

	return nil
}
func (m *NewStarredRepository) validateNamespace(formats strfmt.Registry) error {

	if err := validate.RequiredString("namespace", "body", string(m.Namespace)); err != nil {
		return err
	}

	return nil
}
示例#13
0
func (m *RevertTag) validateImage(formats strfmt.Registry) error {

	if err := validate.RequiredString("image", "body", string(m.Image)); err != nil {
		return err
	}

	return nil
}
示例#14
0
func (o *AddCommentToTaskBody) validateContent(formats strfmt.Registry) error {

	if err := validate.RequiredString("body"+"."+"content", "body", string(o.Content)); err != nil {
		return err
	}

	return nil
}
func (m *NotificationCreateRequest) validateEvent(formats strfmt.Registry) error {

	if err := validate.RequiredString("event", "body", string(m.Event)); err != nil {
		return err
	}

	return nil
}
func (m *LearningResource) validateType(formats strfmt.Registry) error {

	if err := validate.RequiredString("type", "body", string(m.Type)); err != nil {
		return err
	}

	return nil
}
func (m *LearningResource) validateURL(formats strfmt.Registry) error {

	if err := validate.RequiredString("url", "body", string(m.URL)); err != nil {
		return err
	}

	return nil
}
示例#18
0
func (m *RepoUpdate) validateDescription(formats strfmt.Registry) error {

	if err := validate.RequiredString("description", "body", string(m.Description)); err != nil {
		return err
	}

	return nil
}
示例#19
0
func (m *NewPrototypeDelegate) validateName(formats strfmt.Registry) error {

	if err := validate.RequiredString("delegate"+"."+"name", "body", string(m.Name)); err != nil {
		return err
	}

	return nil
}
示例#20
0
func (m *NewPrototypeActivatingUser) validateName(formats strfmt.Registry) error {

	if err := validate.RequiredString("activating_user"+"."+"name", "body", string(m.Name)); err != nil {
		return err
	}

	return nil
}
示例#21
0
func (m *Ticket) validateEventID(formats strfmt.Registry) error {

	if err := validate.RequiredString("event_id", "body", string(m.EventID)); err != nil {
		return err
	}

	return nil
}
示例#22
0
func (m *NewToken) validateFriendlyName(formats strfmt.Registry) error {

	if err := validate.RequiredString("friendlyName", "body", string(m.FriendlyName)); err != nil {
		return err
	}

	return nil
}
示例#23
0
func (m *Error) validateMessage(formats strfmt.Registry) error {

	if err := validate.RequiredString("message", "body", string(m.Message)); err != nil {
		return err
	}

	return nil
}
示例#24
0
func (m *Team) validateName(formats strfmt.Registry) error {

	if err := validate.RequiredString("name", "body", string(m.Name)); err != nil {
		return err
	}

	return nil
}
func (m *NotificationCreateRequest) validateMethod(formats strfmt.Registry) error {

	if err := validate.RequiredString("method", "body", string(m.Method)); err != nil {
		return err
	}

	return nil
}
func (o *DeletePetParams) bindAPIKey(raw string, formats strfmt.Registry) error {
	if err := validate.RequiredString("api_key", "header", raw); err != nil {
		return err
	}

	o.APIKey = raw

	return nil
}
func (o *UpdatePetWithFormParams) bindStatus(raw string, formats strfmt.Registry) error {
	if err := validate.RequiredString("status", "formData", raw); err != nil {
		return err
	}

	o.Status = raw

	return nil
}
示例#28
0
func (m *NewPrototypeDelegate) validateKind(formats strfmt.Registry) error {

	if err := validate.RequiredString("delegate"+"."+"kind", "body", string(m.Kind)); err != nil {
		return err
	}

	if err := m.validateKindEnum("delegate"+"."+"kind", "body", m.Kind); err != nil {
		return err
	}

	return nil
}
示例#29
0
func (m *NewPrototype) validateRole(formats strfmt.Registry) error {

	if err := validate.RequiredString("role", "body", string(m.Role)); err != nil {
		return err
	}

	if err := m.validateRoleEnum("role", "body", m.Role); err != nil {
		return err
	}

	return nil
}
示例#30
0
func (m *Cluster) validateID(formats strfmt.Registry) error {

	if err := validate.RequiredString("id", "body", string(m.ID)); err != nil {
		return err
	}

	if err := validate.MinLength("id", "body", string(m.ID), 1); err != nil {
		return err
	}

	return nil
}