feat(rss2): allow explicit override of guid isPermaLink attribute - #253
Open
mmilanovic4 wants to merge 1 commit into
Open
feat(rss2): allow explicit override of guid isPermaLink attribute#253mmilanovic4 wants to merge 1 commit into
mmilanovic4 wants to merge 1 commit into
Conversation
Currently the isPermaLink attribute on RSS 2.0 <guid> is inferred purely
from which fields are set (guid/id/link), with no way to override it:
- guid or id present -> isPermaLink="false"
- only link present -> isPermaLink="true"
This breaks down in two common cases:
- id/link is a real, permanent URL, but because id is also set,
isPermaLink is forced to "false" (see e.g. discussion in jpmonette#191).
- id is an opaque, non-URL identifier, but a link is also present,
so there's no way to force isPermaLink="false" without dropping link.
This adds an optional isPermaLink?: boolean field on Item that, when
set, takes precedence over the existing inference. When omitted,
behavior is unchanged (fully backwards compatible).
Related: jpmonette#191, jpmonette#89, jpmonette#213
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.
Closes #191
Problem
The
isPermaLinkattribute on the RSS 2.0<guid>element is currently inferred purely from which fields are set on an item, with no way to override it:This breaks down in two real cases:
id/linkis a genuine, permanent URL, but settingidcurrently forcesisPermaLink="false"anyway.idis an opaque, non-URL identifier (e.g. a UUID) and alinkis also present — there's currently no way to forceisPermaLink="false"without droppinglinkentirely, which is the case raised in Way to set guid isPermaLink attribute #191.Solution
Adds an optional
isPermaLink?: booleanfield onItem. When set, it takes precedence over the existing inference:When omitted, behavior is fully unchanged — this is a non-breaking, additive change.
Testing
Added 4 new tests in an isolated
describeblock, usingcreateSampleFeed()rather than the shared, accumulatingsampleFeedfixture (so they don't shift snapshot output for other tests):isPermaLink: truewithid/linkset →isPermaLink="true"isPermaLink: falsewith onlylinkset →isPermaLink="false"isPermaLink+guidset → still defaults toisPermaLink="false"(no regression)isPermaLink+ onlylinkset → still defaults toisPermaLink="true"(no regression)pnpm build,pnpm lint, andpnpm testall pass locally (32/32 tests, no snapshot changes to existing tests).Related
isPermaLink)Closes #191