File: TopicRenderReference.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (503 lines) | stat: -rw-r--r-- 24,970 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
/*
 This source file is part of the Swift.org open source project

 Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
 Licensed under Apache License v2.0 with Runtime Library Exception

 See https://swift.org/LICENSE.txt for license information
 See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/

/// A reference to another page of documentation in the current context.
public struct TopicRenderReference: RenderReference, VariantContainer, Equatable {
    /// The type of this reference.
    ///
    /// This value is always `.topic`.
    public var type: RenderReferenceType = .topic
    
    /// The identifier of the reference.
    public var identifier: RenderReferenceIdentifier
    
    /// The title of the destination page.
    public var title: String {
        get { getVariantDefaultValue(keyPath: \.titleVariants) }
        set { setVariantDefaultValue(newValue, keyPath: \.titleVariants) }
    }
    
    /// The variants of the title.
    public var titleVariants: VariantCollection<String>
    
    /// The topic url for the destination page.
    public var url: String
    
    /// The abstract of the destination page.
    public var abstract: [RenderInlineContent] {
        get { getVariantDefaultValue(keyPath: \.abstractVariants) }
        set { setVariantDefaultValue(newValue, keyPath: \.abstractVariants) }
    }
    
    public var abstractVariants: VariantCollection<[RenderInlineContent]> = .init(defaultValue: [])
    
    /// The kind of page that's referenced.
    public var kind: RenderNode.Kind
    /// Whether the reference is required in its parent context.
    public var required: Bool
    /// The additional "role" assigned to the symbol, if any
    ///
    /// This value is `nil` if the referenced page is not a symbol.
    public var role: String?
    
    /// The abbreviated declaration of the symbol to display in links
    ///
    /// This value is `nil` if the referenced page is not a symbol.
    public var fragments: [DeclarationRenderSection.Token]? {
        get { getVariantDefaultValue(keyPath: \.fragmentsVariants) }
        set { setVariantDefaultValue(newValue, keyPath: \.fragmentsVariants) }
    }
    
    public var fragmentsVariants: VariantCollection<[DeclarationRenderSection.Token]?> = .init(defaultValue: nil)
    
    /// The abbreviated declaration of the symbol to display in navigation
    ///
    /// This value is `nil` if the referenced page is not a symbol.
    public var navigatorTitle: [DeclarationRenderSection.Token]? {
        get { getVariantDefaultValue(keyPath: \.navigatorTitleVariants) }
        set { setVariantDefaultValue(newValue, keyPath: \.navigatorTitleVariants) }
    }
    
    public var navigatorTitleVariants: VariantCollection<[DeclarationRenderSection.Token]?> = .init(defaultValue: nil)
    
    /// Information about conditional conformance for the symbol
    ///
    /// This value is `nil` if the referenced page is not a symbol.
    public var conformance: ConformanceSection?
    /// The estimated time to complete the topic.
    public var estimatedTime: String?
    
    /// Number of default implementations for the symbol
    ///
    /// This value is `nil` if the referenced page is not a symbol.
    public var defaultImplementationCount: Int?
    
    /// A value that indicates whether this symbol is built for a beta platform
    ///
    /// This value is `false` if the referenced page is not a symbol.
    public var isBeta: Bool
    /// A value that indicates whether this symbol is deprecated
    ///
    /// This value is `false` if the referenced page is not a symbol.
    public var isDeprecated: Bool
    
    /// The names and style for a reference to a property list key or entitlement key.
    public var propertyListKeyNames: PropertyListKeyNames?
    
    /// The display name and raw key name for a property list key or entitlement key and configuration about which "name" to use for links to this page.
    public struct PropertyListKeyNames: Equatable {
        /// A style for how to render links to a property list key or an entitlement key.
        public var titleStyle: PropertyListTitleStyle?
        /// The raw key name of a property list key or entitlement key, for example "com.apple.enableDataAccess".
        public var rawKey: String?
        /// The human friendly display name for a property list key or entitlement key, for example, "Enables Data Access".
        public var displayName: String?
    }
    
    /// An optional list of text-based tags.
    public var tags: [RenderNode.Tag]?
    
    /// Author provided images that represent this page.
    public var images: [TopicImage]
    
    /// Creates a new topic reference with all its initial values.
    /// 
    /// - Parameters:
    ///   - identifier: The identifier of this reference.
    ///   - title: The title of the destination page.
    ///   - abstract: The abstract of the destination page.
    ///   - url: The topic url of the destination page.
    ///   - kind: The kind of page that's referenced.
    ///   - required: Whether the reference is required in its parent context.
    ///   - role: The additional "role" assigned to the symbol, if any.
    ///   - fragments: The abbreviated declaration of the symbol to display in links, or `nil` if the referenced page is not a symbol.
    ///   - navigatorTitle: The abbreviated declaration of the symbol to display in navigation, or `nil` if the referenced page is not a symbol.
    ///   - estimatedTime: The estimated time to complete the topic.
    ///   - conformance: Information about conditional conformance for the symbol, or `nil` if the referenced page is not a symbol.
    ///   - isBeta: Whether this symbol is built for a beta platform, or `false` if the referenced page is not a symbol.
    ///   - isDeprecated: Whether this symbol is deprecated, or `false` if the referenced page is not a symbol.
    ///   - defaultImplementationCount: Number of default implementations for this symbol, or `nil` if the referenced page is not a symbol.
    ///   - propertyListKeyNames: The names and style configuration for a property list key or entitlement key,  or `nil` if the referenced page is not a property list key or entitlement key.
    ///   - tags: An optional list of string tags.
    ///   - images: Author provided images that represent this page.
    public init(
        identifier: RenderReferenceIdentifier,
        title: String,
        abstract: [RenderInlineContent],
        url: String,
        kind: RenderNode.Kind,
        required: Bool = false,
        role: String? = nil,
        fragments: [DeclarationRenderSection.Token]? = nil,
        navigatorTitle: [DeclarationRenderSection.Token]? = nil,
        estimatedTime: String? = nil,
        conformance: ConformanceSection? = nil,
        isBeta: Bool = false,
        isDeprecated: Bool = false,
        defaultImplementationCount: Int? = nil,
        propertyListKeyNames: PropertyListKeyNames? = nil,
        tags: [RenderNode.Tag]? = nil,
        images: [TopicImage] = []
    ) {
        self.init(
            identifier: identifier,
            titleVariants: .init(defaultValue: title),
            abstractVariants: .init(defaultValue: abstract),
            url: url,
            kind: kind,
            required: required,
            role: role,
            fragmentsVariants: .init(defaultValue: fragments),
            navigatorTitleVariants: .init(defaultValue: navigatorTitle),
            estimatedTime: estimatedTime,
            conformance: conformance,
            isBeta: isBeta,
            isDeprecated: isDeprecated,
            defaultImplementationCount: defaultImplementationCount,
            propertyListKeyNames: propertyListKeyNames,
            tags: tags,
            images: images
        )
    }
    
    /// Creates a new topic reference with all its initial values.
    ///
    /// - Parameters:
    ///   - identifier: The identifier of this reference.
    ///   - titleVariants: The variants for the title of the destination page.
    ///   - abstractVariants: The abstract of the destination page.
    ///   - url: The topic url of the destination page.
    ///   - kind: The kind of page that's referenced.
    ///   - required: Whether the reference is required in its parent context.
    ///   - role: The additional "role" assigned to the symbol, if any.
    ///   - fragmentsVariants: The abbreviated declaration of the symbol to display in links, or `nil` if the referenced page is not a symbol.
    ///   - navigatorTitleVariants: The abbreviated declaration of the symbol to display in navigation, or `nil` if the referenced page is not a symbol.
    ///   - estimatedTime: The estimated time to complete the topic.
    ///   - conformance: Information about conditional conformance for the symbol, or `nil` if the referenced page is not a symbol.
    ///   - isBeta: Whether this symbol is built for a beta platform, or `false` if the referenced page is not a symbol.
    ///   - isDeprecated: Whether this symbol is deprecated, or `false` if the referenced page is not a symbol.
    ///   - defaultImplementationCount: Number of default implementations for this symbol, or `nil` if the referenced page is not a symbol.
    ///   - propertyListKeyNames: The names and style configuration for a property list key or entitlement key,  or `nil` if the referenced page is not a property list key or entitlement key.
    ///   - tags: An optional list of string tags.
    ///   - images: Author provided images that represent this page.
    public init(
        identifier: RenderReferenceIdentifier,
        titleVariants: VariantCollection<String>,
        abstractVariants: VariantCollection<[RenderInlineContent]>,
        url: String,
        kind: RenderNode.Kind,
        required: Bool = false,
        role: String? = nil,
        fragmentsVariants: VariantCollection<[DeclarationRenderSection.Token]?> = .init(defaultValue: nil),
        navigatorTitleVariants: VariantCollection<[DeclarationRenderSection.Token]?> = .init(defaultValue: nil),
        estimatedTime: String? = nil,
        conformance: ConformanceSection? = nil,
        isBeta: Bool = false,
        isDeprecated: Bool = false,
        defaultImplementationCount: Int? = nil,
        propertyListKeyNames: PropertyListKeyNames? = nil,
        tags: [RenderNode.Tag]? = nil,
        images: [TopicImage] = []
    ) {
        self.identifier = identifier
        self.titleVariants = titleVariants
        self.abstractVariants = abstractVariants
        self.url = url
        self.kind = kind
        self.required = required
        self.role = role
        self.fragmentsVariants = fragmentsVariants
        self.navigatorTitleVariants = navigatorTitleVariants
        self.estimatedTime = estimatedTime
        self.conformance = conformance
        self.isBeta = isBeta
        self.isDeprecated = isDeprecated
        self.defaultImplementationCount = defaultImplementationCount
        self.propertyListKeyNames = propertyListKeyNames
        self.tags = tags
        self.images = images
    }
    
    enum CodingKeys: String, CodingKey {
        case type
        case identifier
        case title
        case url
        case abstract
        case kind
        case required
        case role
        case fragments
        case navigatorTitle
        case estimatedTime
        case conformance
        case beta
        case deprecated
        case defaultImplementations
        case propertyListTitleStyle = "titleStyle"
        case propertyListRawKey = "name"
        case propertyListDisplayName = "ideTitle"
        case tags
        case images
    }
    
    public init(from decoder: Decoder) throws {
        let values = try decoder.container(keyedBy: CodingKeys.self)
        type = try values.decode(RenderReferenceType.self, forKey: .type)
        identifier = try values.decode(RenderReferenceIdentifier.self, forKey: .identifier)
        titleVariants = try values.decode(VariantCollection<String>.self, forKey: .title)
        url = try values.decode(String.self, forKey: .url)
        abstractVariants = try values.decodeIfPresent(VariantCollection<[RenderInlineContent]>.self, forKey: .abstract) ?? .init(defaultValue: [])
        kind = try values.decodeIfPresent(RenderNode.Kind.self, forKey: .kind)
            // Provide backwards-compatibility for TopicRenderReferences that don't have a `kind` key.
            ?? .tutorial
        required = try values.decodeIfPresent(Bool.self, forKey: .required) ?? false
        role = try values.decodeIfPresent(String.self, forKey: .role)
        fragmentsVariants = try values.decodeVariantCollectionIfPresent(ofValueType: [DeclarationRenderSection.Token]?.self, forKey: .fragments) ?? .init(defaultValue: nil)
        navigatorTitleVariants = try values.decodeVariantCollectionIfPresent(ofValueType: [DeclarationRenderSection.Token]?.self, forKey: .navigatorTitle)
        conformance = try values.decodeIfPresent(ConformanceSection.self, forKey: .conformance)
        estimatedTime = try values.decodeIfPresent(String.self, forKey: .estimatedTime)
        isBeta = try values.decodeIfPresent(Bool.self, forKey: .beta) ?? false
        isDeprecated = try values.decodeIfPresent(Bool.self, forKey: .deprecated) ?? false
        defaultImplementationCount = try values.decodeIfPresent(Int.self, forKey: .defaultImplementations)
        let propertyListTitleStyle = try values.decodeIfPresent(PropertyListTitleStyle.self, forKey: .propertyListTitleStyle)
        let propertyListRawKey = try values.decodeIfPresent(String.self, forKey: .propertyListRawKey)
        let propertyListDisplayName = try values.decodeIfPresent(String.self, forKey: .propertyListDisplayName)
        if propertyListRawKey != nil || propertyListRawKey != nil || propertyListDisplayName != nil {
            propertyListKeyNames = PropertyListKeyNames(
                titleStyle: propertyListTitleStyle,
                rawKey: propertyListRawKey,
                displayName: propertyListDisplayName
            )
        }
        tags = try values.decodeIfPresent([RenderNode.Tag].self, forKey: .tags)
        images = try values.decodeIfPresent([TopicImage].self, forKey: .images) ?? []
    }
    
    public func encode(to encoder: Encoder) throws {
        var container = encoder.container(keyedBy: CodingKeys.self)
        
        try container.encode(type, forKey: .type)
        try container.encode(identifier, forKey: .identifier)
        try container.encodeVariantCollection(titleVariants, forKey: .title, encoder: encoder)
        try container.encode(url, forKey: .url)
        try container.encodeVariantCollection(abstractVariants, forKey: .abstract, encoder: encoder)
        try container.encode(kind, forKey: .kind)
        
        if required {
            try container.encode(required, forKey: .required)
        }
        try container.encodeIfPresent(role, forKey: .role)
        try container.encodeVariantCollectionIfNotEmpty(fragmentsVariants, forKey: .fragments, encoder: encoder)
        try container.encodeVariantCollectionIfNotEmpty(navigatorTitleVariants, forKey: .navigatorTitle, encoder: encoder)
        try container.encodeIfPresent(conformance, forKey: .conformance)
        try container.encodeIfPresent(estimatedTime, forKey: .estimatedTime)
        try container.encodeIfPresent(defaultImplementationCount, forKey: .defaultImplementations)
        
        if isBeta {
            try container.encode(isBeta, forKey: .beta)
        }
        if isDeprecated {
            try container.encode(isDeprecated, forKey: .deprecated)
        }
        try container.encodeIfPresent(propertyListKeyNames?.titleStyle, forKey: .propertyListTitleStyle)
        try container.encodeIfPresent(propertyListKeyNames?.rawKey, forKey: .propertyListRawKey)
        try container.encodeIfPresent(propertyListKeyNames?.displayName, forKey: .propertyListDisplayName)
        try container.encodeIfPresent(tags, forKey: .tags)
        try container.encodeIfNotEmpty(images, forKey: .images)
    }
}

// Diffable conformance
extension TopicRenderReference: RenderJSONDiffable {
    /// Returns the difference between two TopicRenderReferences.
    func difference(from other: TopicRenderReference, at path: CodablePath) -> JSONPatchDifferences {
        var diffBuilder = DifferenceBuilder(current: self, other: other, basePath: path)

        diffBuilder.addDifferences(atKeyPath: \.type, forKey: CodingKeys.type)
        diffBuilder.addDifferences(atKeyPath: \.identifier, forKey: CodingKeys.identifier)
        diffBuilder.addDifferences(atKeyPath: \.title, forKey: CodingKeys.title)
        diffBuilder.addDifferences(atKeyPath: \.url, forKey: CodingKeys.url)
        diffBuilder.addDifferences(atKeyPath: \.abstract, forKey: CodingKeys.abstract)
        diffBuilder.addDifferences(atKeyPath: \.kind, forKey: CodingKeys.kind)
        diffBuilder.addDifferences(atKeyPath: \.required, forKey: CodingKeys.required)
        diffBuilder.addDifferences(atKeyPath: \.role, forKey: CodingKeys.role)
        diffBuilder.addDifferences(atKeyPath: \.fragments, forKey: CodingKeys.fragments)
        diffBuilder.addDifferences(atKeyPath: \.navigatorTitle, forKey: CodingKeys.navigatorTitle)
        diffBuilder.addDifferences(atKeyPath: \.conformance, forKey: CodingKeys.conformance)
        diffBuilder.addDifferences(atKeyPath: \.estimatedTime, forKey: CodingKeys.estimatedTime)
        diffBuilder.addDifferences(atKeyPath: \.defaultImplementationCount, forKey: CodingKeys.defaultImplementations)
        diffBuilder.addDifferences(atKeyPath: \.isBeta, forKey: CodingKeys.beta)
        diffBuilder.addDifferences(atKeyPath: \.isDeprecated, forKey: CodingKeys.deprecated)
        diffBuilder.addDifferences(atKeyPath: \.propertyListKeyNames?.titleStyle, forKey: CodingKeys.propertyListTitleStyle)
        diffBuilder.addDifferences(atKeyPath: \.propertyListKeyNames?.rawKey, forKey: CodingKeys.propertyListRawKey)
        diffBuilder.addDifferences(atKeyPath: \.propertyListKeyNames?.displayName, forKey: CodingKeys.propertyListDisplayName)
        diffBuilder.addDifferences(atKeyPath: \.tags, forKey: CodingKeys.tags)
        diffBuilder.addDifferences(atKeyPath: \.images, forKey: CodingKeys.images)
        
        return diffBuilder.differences
    }
}

// MARK: Deprecated

extension TopicRenderReference {
    @available(*, deprecated, renamed: "propertyListTitleStyle", message: "Use 'propertyListTitleStyle' instead. This deprecated API will be removed after 6.1 is released")
    public var titleStyle: TitleStyle? {
        get {
            propertyListKeyNames?.titleStyle.map { $0.titleStyle }
        }
        set {
            if propertyListKeyNames == nil {
                propertyListKeyNames = PropertyListKeyNames()
            }
            propertyListKeyNames!.titleStyle = newValue.map { .init(titleStyle: $0) }
        }
    }
    
    @available(*, deprecated, renamed: "propertyListRawKey", message: "Use 'propertyListRawKey' instead. This deprecated API will be removed after 6.1 is released")
    public var name: String? {
        get { 
            propertyListKeyNames?.rawKey
        }
        set {
            if propertyListKeyNames == nil {
                propertyListKeyNames = PropertyListKeyNames()
            }
            propertyListKeyNames!.rawKey = newValue
        }
    }
    
    @available(*, deprecated, renamed: "propertyListDisplayName", message: "Use 'propertyListDisplayName' instead. This deprecated API will be removed after 6.1 is released")
    public var ideTitle: String? {
        get { 
            propertyListKeyNames?.displayName
        }
        set {
            if propertyListKeyNames == nil {
                propertyListKeyNames = PropertyListKeyNames()
            }
            propertyListKeyNames!.displayName = newValue
        }
    }
    
    @_disfavoredOverload
    @available(*, deprecated, renamed: "init(identifier:title:abstract:url:kind:required:role:fragments:navigatorTitle:estimatedTime:conformance:isBeta:isDeprecated:defaultImplementationCount:propertyListKeyNames:tags:images:)", message: "Use 'init(identifier:title:abstract:url:kind:required:role:fragments:navigatorTitle:estimatedTime:conformance:isBeta:isDeprecated:defaultImplementationCount:propertyListKeyNames:tags:images:)' instead. This deprecated API will be removed after 6.1 is released")
    public init(
        identifier: RenderReferenceIdentifier,
        title: String,
        abstract: [RenderInlineContent],
        url: String,
        kind: RenderNode.Kind,
        required: Bool = false,
        role: String? = nil,
        fragments: [DeclarationRenderSection.Token]? = nil,
        navigatorTitle: [DeclarationRenderSection.Token]? = nil,
        estimatedTime: String? = nil,
        conformance: ConformanceSection? = nil,
        isBeta: Bool = false,
        isDeprecated: Bool = false,
        defaultImplementationCount: Int? = nil,
        titleStyle: TitleStyle? = nil,
        name: String? = nil,
        ideTitle: String? = nil,
        tags: [RenderNode.Tag]? = nil,
        images: [TopicImage] = []
    ) {
        self.init(
            identifier: identifier,
            titleVariants: .init(defaultValue: title),
            abstractVariants: .init(defaultValue: abstract),
            url: url,
            kind: kind,
            required: required,
            role: role,
            fragmentsVariants: .init(defaultValue: fragments),
            navigatorTitleVariants: .init(defaultValue: navigatorTitle),
            estimatedTime: estimatedTime,
            conformance: conformance,
            isBeta: isBeta,
            isDeprecated: isDeprecated,
            defaultImplementationCount: defaultImplementationCount,
            propertyListKeyNames: PropertyListKeyNames(
                titleStyle: titleStyle.map { .init(titleStyle: $0) },
                rawKey: name,
                displayName: ideTitle
            ),
            tags: tags,
            images: images
        )
    }
    
    @_disfavoredOverload
    @available(*, deprecated, renamed: "init(identifier:titleVariants:abstractVariants:url:kind:required:role:fragmentsVariants:navigatorTitleVariants:estimatedTime:conformance:isBeta:isDeprecated:defaultImplementationCount:propertyListKeyNames:tags:images:)", message: "Use 'init(identifier:titleVariants:abstractVariants:url:kind:required:role:fragmentsVariants:navigatorTitleVariants:estimatedTime:conformance:isBeta:isDeprecated:defaultImplementationCount:propertyListKeyNames:tags:images:)' instead. This deprecated API will be removed after 6.1 is released")
    public init(
        identifier: RenderReferenceIdentifier,
        titleVariants: VariantCollection<String>,
        abstractVariants: VariantCollection<[RenderInlineContent]>,
        url: String,
        kind: RenderNode.Kind,
        required: Bool = false,
        role: String? = nil,
        fragmentsVariants: VariantCollection<[DeclarationRenderSection.Token]?> = .init(defaultValue: nil),
        navigatorTitleVariants: VariantCollection<[DeclarationRenderSection.Token]?> = .init(defaultValue: nil),
        estimatedTime: String? = nil,
        conformance: ConformanceSection? = nil,
        isBeta: Bool = false,
        isDeprecated: Bool = false,
        defaultImplementationCount: Int? = nil,
        titleStyle: TitleStyle? = nil,
        name: String? = nil,
        ideTitle: String? = nil,
        tags: [RenderNode.Tag]? = nil,
        images: [TopicImage] = []
    ) {
        self.identifier = identifier
        self.titleVariants = titleVariants
        self.abstractVariants = abstractVariants
        self.url = url
        self.kind = kind
        self.required = required
        self.role = role
        self.fragmentsVariants = fragmentsVariants
        self.navigatorTitleVariants = navigatorTitleVariants
        self.estimatedTime = estimatedTime
        self.conformance = conformance
        self.isBeta = isBeta
        self.isDeprecated = isDeprecated
        self.defaultImplementationCount = defaultImplementationCount
        if titleStyle != nil || name != nil || ideTitle != nil {
            self.propertyListKeyNames = PropertyListKeyNames(
                titleStyle: titleStyle.map { .init(titleStyle: $0) },
                rawKey: name,
                displayName: ideTitle
            )
        }
        self.tags = tags
        self.images = images
    }
}

@available(*, deprecated, message: "This deprecated API will be removed after 6.1 is released")
private extension PropertyListTitleStyle {
    var titleStyle: TitleStyle {
        switch self {
        case .useDisplayName: return .title
        case .useRawKey:      return .symbol
        }
    }
    
    init(titleStyle: TitleStyle) {
        switch titleStyle {
        case .title:  self = .useDisplayName
        case .symbol: self = .useRawKey
        }
    }
}