Skip to content

Support JSON Feed 1.1 authors and language - #224

Merged
nmdias merged 2 commits into
nmdias:mainfrom
alexhumphreys:json-feed-1.1-authors
Aug 26, 2026
Merged

Support JSON Feed 1.1 authors and language#224
nmdias merged 2 commits into
nmdias:mainfrom
alexhumphreys:json-feed-1.1-authors

Conversation

@alexhumphreys

Copy link
Copy Markdown
Contributor

Fixes #223

JSON Feed 1.1 deprecated the singular author in favour of an authors array. 1.1 feeds in the wild omit author entirely — including daringfireball.net/feeds/json and inessential.com/feed.json, both from people who wrote the spec — so author decoded as nil with nothing to fall back to.

  • Add authors to JSONFeed and JSONFeedItem. When the deprecated author is absent, it falls back to authors.first, so existing code reading .author works against 1.1 feeds unchanged. The fallback is one-way: authors is only populated from the feed, so nil still honestly means the feed didn't publish the array.
  • Add language to JSONFeed and JSONFeedItem, the other 1.1 addition.
  • A feed constructed in code using either member encodes as version 1.1, since they aren't valid in a 1.0 feed. Decoded feeds keep the version they arrived with and round-trip unchanged.
  • Decode JSONFeedAuthor.name with decodeIfPresent. The property is already String? and the spec has always listed all members as optional, but the strict decode threw on url-only authors and took the whole feed parse down with it. Separate latent bug, no API change.

Testing: new feed_v1_1.json fixture covering feed and item authors, both language levels, and a url-only author, with decode, round-trip, and regression tests. The existing 1.0 fixture and tests are untouched and pass. Verified against both feeds above: all 48 Daring Fireball items now resolve an author, previously all nil.

Note: I didn't implement feed->item author inheritance. The spec says a missing item author means the top-level one applies (inessential.com relies on this), but adding it would change behaviour for 1.0 feeds too — happy to include it if you'd prefer.

alexhumphreys and others added 2 commits August 16, 2026 20:03
JSON Feed 1.1 deprecated the singular `author` in favour of an `authors`
array, and 1.1 feeds in the wild (daringfireball.net/feeds/json,
inessential.com/feed.json) omit `author` entirely, so `author` decoded as
nil with nothing to fall back to.

- Add `authors` to `JSONFeed` and `JSONFeedItem`, falling back to
  `authors.first` when the deprecated `author` is absent, so both keys
  remain usable regardless of the feed version.
- Add `language` to `JSONFeed` and `JSONFeedItem`, also new in 1.1.
- Set the version to 1.1 when a feed built in code uses either member.
- Decode `JSONFeedAuthor.name` as optional; the spec has always listed all
  of its members as optional, and 1.1 feeds do publish url-only authors.

Fixes nmdias#223

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@nmdias

nmdias commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Looking good! Thank you @alexhumphreys 🚀

@nmdias
nmdias merged commit fbae69b into nmdias:main Aug 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Any plans to support JSON Feed 1.1 (authors)?

2 participants