1. How swift-docc-render consumes this
attributes is one case of RenderSectionKind
(Sources/SwiftDocC/Model/Rendering/RenderSection.swift, line 26 at the pinned commit),
grouped there under the comment // Plist alongside details (encoded as
"details") and possibleValues. Despite that grouping comment, the
translator that produces it (AttributesSectionTranslator) is generic over any symbol
that carries SymbolGraph "constraint" metadata — minimum/maximum bounds, allowed value lists,
allowed type lists, default values — so in practice it shows up not only for Info.plist keys
but for any symbol whose declaration has such constraints attached.
A kind: "attributes" object is a member of a symbol page's top-level
primaryContentSections array. It is consumed by
PrimaryContent.vue's componentFor(section) lookup table, which maps
SectionKind.attributes to the Attributes component, and by the sibling
propsFor(section) table (same file,
lines 106–107), which extracts just the section's attributes array as the
prop:
[SectionKind.attributes]: Attributes,
...
[SectionKind.attributes]: { attributes },
PrimaryContent.vue is rendered from DocumentationTopic.vue (the top-level
symbol/article page shell) for every section in the page's primaryContentSections, so
an attributes section appears as one full-width block in the main content column of a
symbol page, alongside declarations, parameters, properties,
etc.
The actual rendering is
DocumentationTopic/PrimaryContent/Attributes.vue, lines 11–18. Its template root
is a bare <section class="attributes"> containing a
LinkableHeading (an anchored <h2>, since
PrimaryContentSectionAnchors[SectionKind.attributes] pins
anchor: 'attributes', level: 2, title key sections.attributes)
followed by a delegated <ParameterAttributes :attributes="attributes">:
<section class="attributes">
<LinkableHeading :anchor="section.anchor" :level="section.level">
{{ $t(section.title) }}
</LinkableHeading>
<ParameterAttributes :attributes="attributes" />
</section>
All of the real per-attribute rendering logic lives one level down, in
ParameterAttributes.vue — the same component that PropertyTable.vue
and RestParameters.vue/RestBody.vue reuse for the per-row
attributes arrays attached to individual properties/parameters (this doc's schema
counterpart is TypedProperty.attributes, not the section-level payload, but it shares
the exact same wire shape and the same rendering component). It first collapses the incoming array
into a lookup object keyed by each attribute's own kind
(attributesObject computed property, lines 141–149), then conditionally renders
one <ParameterMetaAttribute> row per recognized kind — default,
minimum, minimumExclusive, minimumLength,
maximum, maximumExclusive, maximumLength,
allowedTypes, allowedValues — via
v-if="shouldRender(kind)". Each row's label text is localized
($t('parameters.minimum'), etc.) with an optional per-attribute title
override, and the value is rendered in a <code> element, with
allowedTypes further delegating each declaration fragment to
DeclarationToken.vue for token-level styling/linking.
ParameterMetaAttribute.vue is the leaf: it wraps its value in a
RenderChanged component (so an API-diff badge can be shown if this attribute changed
between versions) and renders a <div class="property-metadata"> containing
whatever the parent slot template produces.
See also: Localization fallback — how $t()/locale-key lookup works across every kind that uses it.
2. Example JSON and rendered mockup
Real fixture: swift-docc's
Tests/SwiftDocCTests/Rendering/Rendering Fixtures/plist-symbol.json (lines 188–198
at the pinned commit) contains a genuine top-level attributes section for a plist-key
symbol page, alongside sibling properties and possibleValues sections on
the same page:
{
"title": "Attributes",
"kind": "attributes",
"attributes": [
{
"kind": "default",
"title": "Default",
"value": "AABBCC"
}
]
}
That fixture only exercises the default attribute kind. To show the other two wire
shapes (ArrayAttribute and TypesAttribute) that the schema also allows in
this array, here is a synthesized, schema-valid extension of the same fixture's symbol
(a hypothetical plist key with a numeric range, an enumerated value list, and an allowed-type list):
{
"title": "Attributes",
"kind": "attributes",
"attributes": [
{ "kind": "minimum", "title": "Minimum", "value": "1" },
{ "kind": "maximum", "title": "Maximum", "value": "10" },
{
"kind": "allowedValues",
"title": "Possible Values",
"values": ["none", "some", "all"]
},
{
"kind": "allowedTypes",
"title": "Possible Types",
"values": [
[ { "kind": "identifier", "text": "String" } ],
[ { "kind": "identifier", "text": "Int" } ]
]
}
]
}
AABBCC110none, some, allString, Intmockup: an "Attributes" H2 (anchor #attributes) followed by one line per
recognized attribute kind, each rendered as a localized label, a colon, and the value in
monospace — matching ParameterAttributes.vue's fixed row order
(default, minimum, minimumExclusive, minimumLength, maximum, maximumExclusive, maximumLength,
allowedTypes, allowedValues), not necessarily the array's original order.
3. Data sheet
Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object
#/components/schemas/AttributesSection (lines 3048–3069), which references
#/components/schemas/Attribute (lines 3070–3082, a oneOf over
StringAttribute, ArrayAttribute, and TypesAttribute, lines
3083–3151). Cross-checked against the generated
Components.Schemas.AttributesSection struct in
Sources/DocCArchive/generated/Types.swift (lines 6772–6952).
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
kind |
string | yes | "attributes" (single-case enum) |
Generated as AttributesSection.KindPayload, one case. Discriminator for this
section type within primaryContentSections. |
title |
string | yes | — | AttributesSectionTranslator always sets this to the literal string
"Attributes" (AttributesSectionTranslator.swift, line 43); the render-side
heading actually shown to users comes not from this field but from the localized string key
sections.attributes pinned by PrimaryContentSectionAnchors. |
attributes |
array of Attribute |
no | default omitted (optional) | Generated as [Components.Schemas.Attribute]?. The Swift-side
AttributesRenderSection.attributes is also optional, but
AttributesSectionTranslator only ever emits a section at all when this array is
non-empty (it returns nil for the whole section otherwise) — so a materialized
attributes section in a real archive should always have at least one entry in
practice, even though the schema itself does not enforce that minimum. |
Attribute (oneOf member) — StringAttribute.kind |
string enum | yes | "default" | "minimum" | "minimumExclusive" | "maximum" | "maximumExclusive" |
Schema/source drift: the vendored JSON schema's StringAttribute
enum omits minimumLength and maximumLength, which the hand-written Swift
RenderAttribute.Kind enum in AttributesRenderSection.swift (line 59)
does include, and which ParameterAttributes.vue also explicitly renders
(AttributeKind.minimumLength / maximumLength). A wire payload using either
length kind is valid per swift-docc's Swift encoder and is rendered correctly by
swift-docc-render, but would not validate against this vendored
RenderNode.spec.json's stricter StringAttribute.kind enum as pinned in
this repository. |
StringAttribute.title |
string | yes | — | Human-readable label, e.g. "Default value", "Minimum"; swift-docc's
RenderAttribute.title computed property supplies these strings when constructing the
attribute (AttributesRenderSection.swift, lines 82–94). |
StringAttribute.value |
string | yes | — | The scalar bound/default, always encoded as a string even for numeric constraints (e.g.
"1.0"), matching RenderAttribute.default(String) / .minimum(String)
etc. |
ArrayAttribute.kind |
string enum | yes | "allowedValues" (single case) |
Corresponds to Swift RenderAttribute.allowedValues([String]). |
ArrayAttribute.values |
array of string | yes | — | The enumerated allowed literal values, e.g. plist-key possible values. |
TypesAttribute.kind |
string enum | yes | "allowedTypes" (single case) |
Corresponds to Swift RenderAttribute.allowedTypes([[DeclarationRenderSection.Token]]). |
TypesAttribute.values |
array of array of DeclarationToken |
yes | — | Each inner array is one allowed type's declaration-token sequence (so a compound type can be
rendered with syntax highlighting/links, not just plain text); rendered by
ParameterAttributes.vue via nested DeclarationToken components joined with
commas. |
4. HTML/CSS mapping in DocC-Render output
<section class="attributes">— root element fromAttributes.vue's template; scoped SCSS in that same file (importingdocc-render/styles/_core.scss) applies exactly two rules:.parameter-attributes { margin-left: 1rem; }and a:deep(.property-metadata) { color: currentColor; }override that forces the nested metadata rows to inherit the ambient text color (e.g. inside a deprecated/beta-colored context) rather than keeping their own gray.<div class="parameter-attributes">— root ofParameterAttributes.vue, indented via the parent'smargin-left: 1remrule above.<div class="property-metadata">— root of eachParameterMetaAttribute.vuerow; its own scoped style setscolor: var(--color-figure-gray-secondary);, i.e. it consumes the CSS custom property--color-figure-gray-secondary(defined per color scheme insrc/styles/core/colors/_light.scss/ the matching dark-scheme partial). This is the one CSS custom property specific to this kind's rendering;Attributes.vue's:deep()override described above exists specifically to neutralize this color in certain ancestor contexts.- No dedicated top-level
.scsspartial file exists for this component — all styling is inline in each component's own scoped<style>block (Attributes.vue,ParameterMetaAttribute.vue);ParameterAttributes.vueandParameterMetaAttribute.vue's slot templates ship no styling of their own beyond what's noted above. - The section heading is rendered by the shared
LinkableHeading.vuecomponent (an<h2>here, sincePrimaryContentSectionAnchors.attributes.levelis2) withid="attributes"from itsanchorprop, making#attributesa stable deep-link target into the page.
DocCArchive transform status: MyHTMLTransformer and MyMarkdownTransformer
in Sources/DocCArchive/DocCArchive.swift are still stub placeholders (the HTML
transformer returns a hardcoded comment, the Markdown transformer returns an empty string); neither
has any kind-specific handling for AttributesSection or its nested
Attribute payloads today.
5. Modern CSS-only alternative
NOT APPLICABLE
Current behavior: none of the components on this path (Attributes.vue,
ParameterAttributes.vue, ParameterMetaAttribute.vue) hold any client-side
UI state. ParameterAttributes.vue's only "logic" is a pure computed transform
(attributesObject, array → keyed object) and a pure predicate
(shouldRender(kind), an Object.prototype.hasOwnProperty check) used purely
to decide which v-if rows are present in the rendered output; there is no toggle, no
tab, no expand/collapse, and no click handler anywhere in this component tree. The only dynamic
behavior involved is RenderChanged.vue's optional "this value changed in a newer OS
version" diff badge, which is driven by data already present in the page's JSON
(changes prop), not by any user interaction. Because there is no interactive state to
replace, no native mechanism (<details>, :checked, :target,
:has(), the Popover API, etc.) has anything to hold in place of JavaScript here —
this kind is a static, server-renderable list of label/value rows from first render to last.