From 656ae8ad46c68cbc4900660a0a97d9d337a6af93 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Tue, 15 Oct 2024 18:40:32 +0200 Subject: [PATCH] Add comments to author checks --- entry.go | 4 ++++ feed.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/entry.go b/entry.go index 3f62163..044af1e 100644 --- a/entry.go +++ b/entry.go @@ -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 { diff --git a/feed.go b/feed.go index f07b3f7..d9df79e 100644 --- a/feed.go +++ b/feed.go @@ -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 {