func (res Resource) Validate() error {
	if err := res.Meta.Validate(); err != nil {
		return errors.Annotate(err, "bad metadata")
	}

	if err := res.Origin.Validate(); err != nil {
		return errors.Annotate(err, "bad origin")
	}

	if err := res.validateRevision(); err != nil {
		return errors.Annotate(err, "bad revision")
	}

	if res.Type == TypeFile {
		if err := res.validateFileInfo(); err != nil {
			return errors.Annotate(err, "bad file info")
		}
	}

	return nil
}
// Validate checks the payload class to ensure its data is valid.
Validate checks the payload class to ensure its data is valid.
// Validate checks the payload class to ensure its data is valid .
func (res Resource) Validate() error {
	if err := res.Meta.Validate(); err != nil {
		return errors.Annotate(err, "bad metadata")
	}
	if err := res.Origin.Validate(); err != nil {
		return errors.Annotate(err, "bad origin")
	}
	if err := res.validateRevision(); err != nil {
		return errors.Annotate(err, "bad revision")
	}
	if res.Type == TypeFile {
		if err := res.validateFileInfo(); err != nil {
			return errors.Annotate(err, "bad file info")
		}
	}
	return nil
}
func ( res Resource ) Validate ( ) error { if err := res . Meta . Validate ( ) ; err != nil { return errors . Annotate ( err , " " ) } if err := res . Origin . Validate ( ) ; err != nil { return errors . Annotate ( err , " " ) } if err := res . validateRevision ( ) ; err != nil { return errors . Annotate ( err , " " ) } if res . Type == TypeFile { if err := res . validateFileInfo ( ) ; err != nil { return errors . Annotate ( err , " " ) } } return nil }
Validate checks the payload class to ensure its data is valid.
Validate checks the payload class to ensure its data is valid .