1. How swift-docc-render consumes this
Grepping src/ for the literal string possibleValues turns up a small, self-consistent
cluster of files under src/constants/ and src/components/DocumentationTopic/. The wire
value is first named as a SectionKind constant in
constants/PrimaryContentSection.js#L12-L27
(possibleValues: 'possibleValues'), then given a section heading/anchor in
constants/ContentSectionAnchors.js#L34-L57:
[SectionKind.possibleValues]: {
title: 'sections.possible-values',
anchor: 'possibleValues',
level: 2,
},
That constant is consumed by the same primary-content dispatch table documented on the sibling
content/attributes/parameters pages,
DocumentationTopic/PrimaryContent.vue#L73-L127.
A section whose kind is "possibleValues" is mounted as the dedicated
PossibleValues component, and only its values field is forwarded as a prop:
componentFor(section) {
return {
...
[SectionKind.possibleValues]: PossibleValues,
...
}[section.kind];
},
propsFor(section) {
...
return {
...
[SectionKind.possibleValues]: { values },
...
}[kind];
},
The presentation itself lives entirely in
DocumentationTopic/PrimaryContent/PossibleValues.vue#L11-L53,
a small single-file component with no local state:
<template>
<section>
<LinkableHeading :anchor="contentSectionData.anchor">
{{ $t(contentSectionData.title) }}
</LinkableHeading>
<dl class="datalist">
<template v-for="value in values">
<dt class="param-name" :key="`${value.name}:name`">
<WordBreak tag="code">{{ value.name }}</WordBreak>
</dt>
<dd v-if="value.content" class="value-content" :key="`${value.name}:content`">
<ContentNode :content="value.content" />
</dd>
</template>
</dl>
</section>
</template>
So the component renders one heading (via the shared LinkableHeading component, using the
localized string key sections.possible-values — "Possible Values" in
lang/locales/en-US.json#L108 —
rather than the JSON payload's own title string, which is never read by this component) followed by
a single <dl> definition list: each value's name becomes a <dt>
(wrapped in WordBreak, rendered as an inline <code>), and — only if that value
carries a content array — a following <dd> delegates to the shared
ContentNode component to render arbitrary block content. Values with no content
produce a bare <dt> with no matching <dd> at all (the v-if
guard), which is exactly the shape seen for the "ppc" and "arm" entries in the
example fixture below. There is no click handling, toggling, or other interactive behavior anywhere in this
component; it is a pure one-time template render driven by the values prop.
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 own rendering test fixture
Tests/SwiftDocCTests/Rendering/Rendering Fixtures/plist-symbol.json (lines 199–219), one entry
of that RenderNode's primaryContentSections array for a documented property-list key. No JSON
example of this section kind was found in DocCArchive's own ExampleDocs.doccarchive /
SampleLibrary.doccarchive test fixtures (those archives don't document any property-list-style
symbols), so this example is taken from swift-docc's test suite instead, per the sourcing priority order.
{
"title": "Possible Values",
"kind": "possibleValues",
"values": [
{ "name": "ppc" },
{
"name": "i386",
"content": [
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "Any i386 type of processor" }
]
}
]
},
{ "name": "arm" }
]
}
- ppc
- i386
- Any i386 type of processor
- arm
mockup: note that "ppc" and "arm" have no content, so they
render as bare terms with no description line beneath them — only "i386", which supplies a
content array, gets a <dd> underneath it. The heading text shown here
("Possible Values") actually comes from the client's own localized string table, not from the JSON
payload's title field, which this component never reads (see Section 1).
3. Data sheet
Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object
#/components/schemas/PossibleValuesSection (lines 3012–3047), cross-checked against
Components.Schemas.PossibleValuesSection in
Sources/DocCArchive/generated/Types.swift (lines 6713–6771). This is one arm of the
DocumentationPrimaryRenderSection discriminated union (schema, around line 2537) that makes up a
symbol RenderNode's primaryContentSections array.
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
kind |
string | yes | "possibleValues" (single-value enum) |
Generated as KindPayload: String, Codable, Hashable, Sendable, CaseIterable { case possibleValues }.
On the swift-docc production side this is one member of the shared, larger RenderSectionKind
Swift enum (RenderSection.swift, line 26) grouped there under the comment "Plist" alongside
details and attributes. |
title |
string | no | — | Optional on the wire and in the generated Swift.String?. On the swift-docc production side,
PossibleValuesSectionTranslator always supplies
PropertyListPossibleValuesSection.title — the fixed string "Possible Values" — so
in practice every RenderNode swift-docc emits has this field populated. Note swift-docc-render's own
PossibleValues.vue component never reads this field at all; it renders its own localized heading
string instead (Section 1), so this field is effectively inert for the primary consumer of the format. |
values |
array of NamedValue objects ({ name, content? }) |
yes | — | Each item requires name (string) and has an optional content array of
RenderBlockContent. Matches swift-docc's Swift-side
PossibleValuesRenderSection.NamedValue struct (name: String,
content: [RenderBlockContent]?) exactly — no schema/model mismatch for this section kind. |
values[].name |
string | yes | — | The literal possible value, e.g. "ppc". Authored on the Swift-side via a
- PossibleValue: (singular) or - PossibleValues: (plural) Markdown list marker,
consumed by ListItemExtractor.swift and validated against the symbol's actual declared
possible-value set by PropertyListPossibleValuesSection.Validator, which emits the
org.swift.docc.DocumentedPossibleValueNotFound diagnostic for names that don't match. |
values[].content |
array of RenderBlockContent |
no | — | Arbitrary block content describing the value. Absent for self-explanatory values (matches
PossibleValuesRenderSection.NamedValue's doc comment: "Some values are self-explanatory in their
context like '2' or 'Info.plist'"). |
4. HTML/CSS mapping in DocC-Render output
Rendered DOM, outer to inner, for a possibleValues-kind entry inside a symbol page's primary
content list:
div.primary-content— the root element ofDocumentationTopic/PrimaryContent.vue, shared with every other primary-content section kind (see thecontentkind's reference page for detail on this outer wrapper).<section>— the root element ofPossibleValues.vueitself (PossibleValues.vue#L11-L27), with no distinguishing class of its own.- Inside it, an
<h2 id="possibleValues">(the anchor id set byLinkableHeading's:id="anchor"binding, using the constantanchor: 'possibleValues'fromContentSectionAnchors.js) wrapping arouter-link.header-anchordeep-link icon, matching the anchor/heading pattern used by every other linkable section heading on the site. dl.datalist— one definition list for the whole section (PossibleValues.vue#L16-L25), containing onedt.param-name > codeper value name (via the sharedWordBreakcomponent) and, only for values that have acontentarray, a followingdd.value-contentwhose children are whatever block components the nestedContentNoderesolves the content array to (typically<p>paragraphs).
SCSS: entirely inline in PossibleValues.vue's own scoped style block
(PossibleValues.vue#L54-L74),
which imports the shared docc-render/styles/_core.scss only for its color/spacing tokens. The
component defines its own local $left-padding: 1rem SCSS variable and uses it to indent both
dt (one $left-padding) and dd (two $left-padding, i.e.
2rem) from the list's left edge.
CSS custom properties consumed: --spacing-param, used for dt's
padding-top. That property is defined once, globally, in
styles/base/_typography.scss#L48
as rem(28px), and is overridden per-page context in
DocumentationTopic.vue (line 855) to equal --spacing-stacked-margin-large; the same
custom property is reused verbatim by the sibling Parameters.vue,
ParametersTable.vue, and PropertyListKeyDetails.vue components, so
possibleValues visually lines up with those other definition-list-shaped sections.
DocCArchive transform status: not yet implemented. MyHTMLTransformer and
MyMarkdownTransformer in Sources/DocCArchive/DocCArchive.swift (lines 242–253)
are still stub placeholders — the HTML transformer returns a hardcoded <!-- what? -->
comment regardless of input, and the Markdown transformer returns an empty string — so there is no code path
today that walks a PossibleValuesSection's values array into HTML or Markdown
output.
5. Modern CSS-only alternative
NOT APPLICABLE
Current behavior in play: as shown in Section 1, PossibleValues.vue holds no component data,
no computed toggle state, and no event handlers beyond the ordinary deep-link click handling shared by every
LinkableHeading instance on the site (which merely scrolls to and focuses the target element —
itself already just a same-page anchor jump, i.e. exactly what a plain <a href="#possibleValues">
does natively). The v-if="value.content" guard that decides whether a given value gets a
<dd> at all is evaluated once, at render time, from data already present in the JSON
payload — it is not a runtime UI toggle a user can invoke. There is consequently no interactive/stateful
behavior on this section to replace: nothing here shows/hides, expands/collapses, or switches views in
response to user input. A static server-rendered <section><h2>...</h2><dl>...</dl></section>
with the same children would be behaviorally identical to what Vue mounts today. (Individual
RenderBlockContent items nested inside a value's content array — e.g. a tab
navigator or disclosure aside — may have their own genuinely interactive behavior, but that is scoped to
those child kinds' own reference pages, not to the possibleValues section wrapper documented
here.)