Skip to content

Conversation

@anferbui
Copy link
Contributor

Bug/issue #, if applicable: rdar://164628218

Summary

Support for absolute URLs in link summaries was added in 7db36ad.

It added support for absolute URLs when decoding a link summary, but not when encoding it:

let decodedURL = try container.decode(URL.self, forKey: .relativePresentationURL)
(relativePresentationURL, absolutePresentationURL) = Self.checkIfDecodedURLWasAbsolute(decodedURL)
try container.encode(relativePresentationURL, forKey: .relativePresentationURL)

Both are needed when using an external link resolver, as the external link resolver needs to encode the entity to send it to DocC.

Dependencies

N/A

Testing

Unit tested.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran the ./bin/test script and it succeeded
  • [ ] Updated documentation if necessary N/A

@anferbui anferbui requested a review from d-ronnqvist November 13, 2025 12:16
@anferbui
Copy link
Contributor Author

@swift-ci please test

The `Equatable` implementation of `LinkDestinationSummary` was missing some of the new fields which were added recently.

This commit adds them.
Support for absolute URLs in link summaries was added in 7db36ad.

It added support for absolute URLs when decoding a link summary, but not when encoding it:
https://github.com/swiftlang/swift-docc/blob/cfcd96f0e992af2287661f6a26e8398096f6bc1e/Sources/SwiftDocC/LinkTargets/LinkDestinationSummary.swift#L772-L773
https://github.com/swiftlang/swift-docc/blob/cfcd96f0e992af2287661f6a26e8398096f6bc1e/Sources/SwiftDocC/LinkTargets/LinkDestinationSummary.swift#L728

Both are needed when using an external link resolver, as the external link resolver needs to encode the entity to send to DocC.

Fixes rdar://164628218.
@anferbui anferbui force-pushed the encode-absolute-urls-in-link-summaries branch from 05e786c to 40805b0 Compare November 13, 2025 13:56
@anferbui
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@d-ronnqvist d-ronnqvist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

Thanks for fixing the == implementation! I had missed that previously.

@anferbui anferbui merged commit 20a0c8b into swiftlang:main Nov 13, 2025
2 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.

2 participants