feat: allow FeedOptions.author to be Author | Author[]#135
Merged
Conversation
The neutral model capped the feed at a single author even though two of the three formats allow more: RFC 4287 §4.1.1 permits multiple feed-level atom:author elements, and JSON Feed 1.1's authors is an array by definition (we always emitted a one-element array). RSS still collapses to the first author via firstAuthor(), same as it already does for item-level authors. Atom 1.0/0.3 now emit one <author> per entry via authorList(), and JSON Feed maps the full list to authors (or the first to the singular author for jsonFeedVersion 1). validateInput's "feed needs an author unless every item has one" rule now treats an empty author array the same as no author, matching the existing item-level check — both now share utils/author.ts's hasAuthor(). Backward-compatible: a plain Author keeps working everywhere.
5740ed3 to
48de8fe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FeedOptions.authornow acceptsAuthor | Author[], matching whatFeedItem.authoralready accepted.Why?
The neutral model capped the feed at a single author for no spec-side
reason, even though two of the three formats allow more:
atom:author elements, unless…" — multiple feed-level
<author>elementsare explicitly permitted.
authorsis an array by definition; we always emitteda one-element array.
managingEditorstays single: uses the existingfirstAuthor()collapse-to-first helper, exactly like item-level authors already do.
All the normalization infrastructure already existed (
authorList()/firstAuthor()insrc/utils/author.ts), built for exactly this dualshape — the item level and the feed level were just asymmetric.
Also:
validateInput's "feed needs an author unless every item has one"rule (RFC 4287 §4.1.1) used to check
!options.author, which treats anempty array as truthy — a
[]author on the feed would have silentlysatisfied the rule. Added a shared
hasAuthor()toutils/author.tssoboth the feed-level and item-level checks now correctly treat an empty
array as "no author," and
validate.ts's local duplicate of the item-levelcheck was removed in favor of it.
Backward-compatible: a plain
Authorkeeps working everywhere.Related issue(s)
closes #127
Check
CONTRIBUTING.md(rules)pnpm check(lint & format)pnpm test(functions test)pnpm build(dist/)pnpm test:coverageand check nothing new went uncovered