Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Sources/SwiftDocC/LinkTargets/LinkDestinationSummary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public struct LinkDestinationSummary: Codable, Equatable {
// so that external documentation sources don't need to provide that data.
// Adding new required properties is considered breaking change since existing external documentation sources
// wouldn't necessarily meet these new requirements.

// Make sure to update the encoding, decoding and Equatable implementations when adding new properties.

/// A collection of identifiers that all relate to some common task, as described by the title.
public struct TaskGroup: Codable, Equatable {
/// The title of this task group
Expand Down Expand Up @@ -725,7 +726,7 @@ extension LinkDestinationSummary {
} else {
try container.encode(kind, forKey: .kind)
}
try container.encode(relativePresentationURL, forKey: .relativePresentationURL)
try container.encode(absolutePresentationURL ?? relativePresentationURL, forKey: .relativePresentationURL)
try container.encode(referenceURL, forKey: .referenceURL)
try container.encode(title, forKey: .title)
try container.encodeIfPresent(abstract, forKey: .abstract)
Expand Down Expand Up @@ -935,12 +936,15 @@ extension LinkDestinationSummary {
guard lhs.kind == rhs.kind else { return false }
guard lhs.language == rhs.language else { return false }
guard lhs.relativePresentationURL == rhs.relativePresentationURL else { return false }
guard lhs.absolutePresentationURL == rhs.absolutePresentationURL else { return false }
guard lhs.title == rhs.title else { return false }
guard lhs.abstract == rhs.abstract else { return false }
guard lhs.availableLanguages == rhs.availableLanguages else { return false }
guard lhs.platforms == rhs.platforms else { return false }
guard lhs.taskGroups == rhs.taskGroups else { return false }
guard lhs.plainTextDeclaration == rhs.plainTextDeclaration else { return false }
guard lhs.subheadingDeclarationFragments == rhs.subheadingDeclarationFragments else { return false }
guard lhs.navigatorDeclarationFragments == rhs.navigatorDeclarationFragments else { return false }
guard lhs.redirects == rhs.redirects else { return false }
guard lhs.topicImages == rhs.topicImages else { return false }
guard lhs.variants == rhs.variants else { return false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,10 @@ class ExternalReferenceResolverTests: XCTestCase {
""".utf8))
XCTAssertEqual(externalEntity.relativePresentationURL.absoluteString, "/path/to/something")
XCTAssertEqual(externalEntity.absolutePresentationURL?.absoluteString, "https://com.example/path/to/something")


// Test that encoding the link summary preserves the absolute URL
try assertRoundTripCoding(externalEntity)

let resolver = Resolver(entityToReturn: externalEntity)

var configuration = DocumentationContext.Configuration()
Expand Down