func (t *Theme) Validate() error {
	if t.ID == "" {
		return errors.New("id required")
	}
	if err := validateDocID(t.ID); err != nil {
		return err
	}
	if !strings.HasPrefix(t.ID, "theme-") {
		return errors.New("incorrect doc type")
	}
	if t.Created.IsZero() {
		return errors.New("created time required")
	}
	if t.Modified.IsZero() {
		return errors.New("modified time required")
	}
	if t.Attachments == nil {
		return errors.New("attachments collection must not be nil")
	}
	if t.Files == nil {
		return errors.New("file list must not be nil")
	}
	if !t.Attachments.hasMemberView(t.Files) {
		return errors.New("file list must be a member of attachments collection")
	}
	for _, m := range t.Models {
		if t.ModelSequence <= m.ID {
			return errors.New("modelSequence must be larger than existing model IDs")
		}
		if !t.Attachments.hasMemberView(m.Files) {
			return errors.Errorf("model %d file list must be a member of attachments collection", m.ID)
		}
		if err := m.Validate(); err != nil {
			return errors.Wrap(err, "invalid model")
		}
	}
	return nil
}
// Validate validates that all of the data in the theme, including its models,
// appears valid and self consistent. A nil return value means no errors were
// detected.
Validate validates that all of the data in the theme, including its models,
appears valid and self consistent. A nil return value means no errors were
detected.
// Validate validates that all of the data in the theme including its models // appears valid and self consistent . A nil return value means no errors were // detected .
func (t *Theme) Validate() error {
	if t.ID == "" {
		return errors.New("id required")
	}
	if err := validateDocID(t.ID); err != nil {
		return err
	}
	if !strings.HasPrefix(t.ID, "theme-") {
		return errors.New("incorrect doc type")
	}
	if t.Created.IsZero() {
		return errors.New("created time required")
	}
	if t.Modified.IsZero() {
		return errors.New("modified time required")
	}
	if t.Attachments == nil {
		return errors.New("attachments collection must not be nil")
	}
	if t.Files == nil {
		return errors.New("file list must not be nil")
	}
	if !t.Attachments.hasMemberView(t.Files) {
		return errors.New("file list must be a member of attachments collection")
	}
	for _, m := range t.Models {
		if t.ModelSequence <= m.ID {
			return errors.New("modelSequence must be larger than existing model IDs")
		}
		if !t.Attachments.hasMemberView(m.Files) {
			return errors.Errorf("model %d file list must be a member of attachments collection", m.ID)
		}
		if err := m.Validate(); err != nil {
			return errors.Wrap(err, "invalid model")
		}
	}
	return nil
}
func ( t * Theme ) Validate ( ) error { if t . ID == " " { return errors . New ( " " ) } if err := validateDocID ( t . ID ) ; err != nil { return err } if ! strings . HasPrefix ( t . ID , " " ) { return errors . New ( " " ) } if t . Created . IsZero ( ) { return errors . New ( " " ) } if t . Modified . IsZero ( ) { return errors . New ( " " ) } if t . Attachments == nil { return errors . New ( " " ) } if t . Files == nil { return errors . New ( " " ) } if ! t . Attachments . hasMemberView ( t . Files ) { return errors . New ( " " ) } for _ , m := range t . Models { if t . ModelSequence <= m . ID { return errors . New ( " " ) } if ! t . Attachments . hasMemberView ( m . Files ) { return errors . Errorf ( " " , m . ID ) } if err := m . Validate ( ) ; err != nil { return errors . Wrap ( err , " " ) } } return nil }
Validate validates that all of the data in the theme, including its models,
appears valid and self consistent.
Validate validates that all of the data in the theme including its models appears valid and self consistent .