Add comments to author checks

This commit is contained in:
Jason Streifling 2024-10-15 18:40:32 +02:00
parent 4f3135dcc6
commit 656ae8ad46
2 changed files with 7 additions and 0 deletions

View File

@ -27,6 +27,10 @@ type Entry struct {
Extensions []*ExtensionElement `xml:",any,omitempty"`
}
// atom:entry elements MUST contain one or more atom:author elements, unless
// the atom:entry contains an atom:source element that contains an atom:author
// element or, in an Atom Feed Document, the atom:feed element contains an
// atom:author element itself.
func (e *Entry) checkAuthors() error {
if e.Authors == nil {
if e.Source.Authors == nil {

View File

@ -142,6 +142,9 @@ func (f *Feed) Check() error {
}
}
// atom:feed elements MUST contain one or more atom:author elements, unless
// all of the atom:feed element's child atom:entry elements contain at
// least one atom:author element.
if f.Authors == nil {
for _, e := range f.Entries {
if err := e.checkAuthors(); err != nil {