Skip to content

Support multiple categories while retaining legacy Category fields - #6

Merged
soulteary merged 1 commit into
mainfrom
fix/multiple-categories
Oct 28, 2026
Merged

soulteary merged 1 commit into
mainfrom
fix/multiple-categories

Conversation

@soulteary

Copy link
Copy Markdown
Owner

Address gorilla#77 and gorilla#116 without removing or changing the existing low-level Category string fields. Add category support to the generic Feed/Item model and map it through all applicable formats.

Mapping

  • Generic Feed/Item expose Category string and Categories []string. Merge the singular first, then nonempty, distinct categories in stable order; compare exact strings without rewriting case or whitespace.
  • RSS channels and items emit repeated category elements; retain existing RssFeed.Category / RssItem.Category and add complete Categories collections.
  • Atom feeds and entries emit category term attributes. Introduce AtomCategory with Term, Scheme, and Label, retain legacy Category strings, and preserve rich metadata and same-term categories with different schemes/labels. Read legacy text-only Atom categories, but always emit standard term attributes.
  • JSON items map categories to tags. JSON Feed has no standard feed-level category field, so feed categories are not emitted there and are never inherited by items.

Compatibility

Existing Category field names/types remain intact. RSS single-category output and all no-category golden outputs are unchanged. Atom's legacy text category output intentionally becomes standards-compliant term output. XML decoding retains all categories and mirrors the first term in Category; missing category elements preserve reused values, while explicit elements replace the collection. Serialization does not mutate source slices/objects. Additive public fields can require updates to positional struct literals; keyed literals using existing fields remain valid. No dependencies added.

Validation

  • Regression coverage for singular/plural merging, duplicates, empty/nil collections, case/whitespace, Unicode/XML/JSON escaping, channel/entry separation, JSON tags, all generic writer APIs, low-level value/pointer XML marshaling, category metadata roundtrips, reused objects, and source immutability.
  • An existing-API Atom term-attribute regression fails on baseline 990af41 and passes here; the multi-category APIs are new.
  • go test -race -cover ./... passes (97.1% statement coverage), go vet ./... and git diff --check pass, with module downloads disabled.
  • Tested locally with Go 1.27.1 on macOS arm64; the Go 1.20/1.21 and multi-OS CI matrix was not run locally.

References: Atom RFC 4287, RSS 2.0, JSON Feed 1.1.

AI assistance: implemented and tested with Codex.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T04:08:05.536880Z 351ce92 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@soulteary
soulteary merged commit 3f1729a into main Oct 28, 2026
@soulteary
soulteary deleted the fix/multiple-categories branch October 28, 2026 04:07
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.

1 participant