nmdias / FeedKit

An RSS, Atom and JSON Feed parser written in Swift
MIT License
1.19k stars 174 forks source link

Coerce Int ids to String #159

Closed chrisjenkins closed 17 hours ago

chrisjenkins commented 6 months ago

According to the JSON Feed specification (https://www.jsonfeed.org/version/1/), item ids should be coerced to strings:

id (required, string) is unique for that item for that feed over time. If an item is ever updated, the id should be unchanged. New items should never use a previously-used id. If an id is presented as a number or other type, a JSON Feed reader must coerce it to a string

The init method is thus changed to detect an invalid encoding and try an alternate type instead.

nmdias commented 17 hours ago

Thank you @chrisjenkins