1. How swift-docc-render consumes this
A properties primary-content section is a symbol-page section (like declarations
or parameters), not a block/inline content kind, so it is not handled by
ContentNode.vue's renderNode() dispatch table. Its dispatch site is the
section-kind lookup table in
DocumentationTopic/PrimaryContent.vue#L74-L127,
which maps the wire-format SectionKind constants
(constants/PrimaryContentSection.js#L11-L26,
where properties: 'properties' is defined) to a component and a props object:
componentFor(section) {
return {
...
[SectionKind.properties]: PropertyTable,
...
}[section.kind];
},
propsFor(section) {
const { ..., items, kind, ..., title, ... } = section;
return {
...
[SectionKind.properties]: { properties: items, title },
...
}[kind];
},
(PrimaryContent.vue#L80,L112.)
So a properties section's items array is renamed to the prop
properties and handed, together with title, to
PrimaryContent/PropertyTable.vue.
That component renders a <section> with a LinkableHeading for
title (anchored via anchorize(title)), then delegates the actual row layout to
the shared ParametersTable component — the same generic two-column "symbol / description"
table used for the parameters section kind:
<section>
<LinkableHeading :anchor="anchor">{{ title }}</LinkableHeading>
<ParametersTable :parameters="properties" :changes="propertyChanges" class="property-table">
<template #symbol="{ name, type, content, changes, deprecated }">
<div class="property-name" :class="{ deprecated: deprecated }">
<WordBreak tag="code">{{ name }}</WordBreak>
</div>
<PossiblyChangedType v-if="!shouldShiftType({name, content})" :type="type" :changes="changes.type" />
</template>
<template #description="{ name, type, attributes, content, required, changes, deprecated, readOnly }">
...
</template>
</ParametersTable>
</section>
(PropertyTable.vue#L11-L62.)
Per property row, the symbol slot renders the property's name (wrapped in
WordBreak for long identifiers, struck through via CSS if deprecated) plus its
declaration type tokens — unless shouldShiftType() decides the type belongs in
the description column instead (this happens when the property has no content markup and
does have a name, so the type isn't left stranded with nothing next to it —
PropertyTable.vue#L100-L106).
The description slot renders, in order: the shifted type (if applicable), a
"Deprecated" Badge, a parenthesized "(Required)" / "(Read-Only)" text fragment driven by the
boolean required/readOnly fields, the property's own content
markup (via the ordinary ContentNode block-content renderer), and finally a
ParameterAttributes block that renders the attributes array — each entry a
tagged union keyed by an internal kind string (default, minimum,
minimumExclusive, maximum, maximumExclusive,
minimumLength, maximumLength, allowedTypes,
allowedValues) rendered as "Label: value" lines
(ParameterAttributes.vue#L11-L100).
The actual grid layout (one row per property, a narrow "symbol" column and a wide "description" column)
lives in the shared
ParametersTable.vue#L11-L27,
which is not specific to properties — it is the same table body used by the
parameters, restParameters, restHeaders, restCookies,
and restResponses section kinds, all of which share this "list of named, typed things with
attributes" shape.
2. Example JSON and rendered mockup
This example is adapted from the real assertions in swift-docc's
Tests/SwiftDocCTests/Model/SemaToRenderNodeDictionaryDataTests.swift::testDictionaryRenderNodeHasExpectedContent
(pinned commit 8b8d8268aa1), which decodes the DictionaryData.docc test bundle's
Artist dictionary symbol and asserts on the resulting PropertiesRenderSection
(title "Properties", four items: age, genre,
monthOfBirth, name, with attributes such as minimum/maximum,
default/allowedValues, and allowedTypes respectively). The test
asserts on the decoded Swift model, not on a raw JSON fixture file, so the JSON below is reconstructed
from those assertions plus the PropertiesRenderSection/RenderAttribute
Codable implementations in
Model/Rendering/Symbol/PropertiesRenderSection.swift
and
Model/Rendering/Symbol/AttributesRenderSection.swift#L96-L119
(the attribute's Decodable init shows the exact wire keys: kind, title,
and either value or values).
{
"kind": "properties",
"title": "Properties",
"items": [
{
"name": "age",
"type": [{ "kind": "identifier", "text": "integer" }],
"deprecated": true,
"attributes": [
{ "kind": "minimum", "title": "Minimum", "value": "0" },
{ "kind": "maximum", "title": "Maximum", "value": "120" }
]
},
{
"name": "genre",
"type": [{ "kind": "identifier", "text": "string" }],
"readOnly": true,
"attributes": [
{ "kind": "default", "title": "Default value", "value": "Classic Rock" },
{
"kind": "allowedValues",
"title": "Possible Values",
"values": ["Classic Rock", "Folk", "null"]
}
]
},
{
"name": "monthOfBirth",
"type": [{ "kind": "identifier", "text": "integer" }],
"typeDetails": [
{ "baseType": "integer" },
{ "baseType": "string" }
],
"attributes": [
{
"kind": "allowedTypes",
"title": "Possible Types",
"values": [
[{ "kind": "identifier", "text": "integer" }],
[{ "kind": "identifier", "text": "string" }]
]
}
]
},
{
"name": "name",
"type": [{ "kind": "identifier", "text": "string" }],
"required": true
}
]
}
A mockup of the resulting PropertyTable/ParametersTable rendering:
age0 Maximum: 120genre (Read-Only)Classic Rock Possible Values: Classic Rock, Folk, nullmonthOfBirthinteger, stringname3. Data sheet
Fields of PropertiesSection (wire object for a properties section), from
Sources/DocCArchive/Vendored/RenderNode.spec.json and the corresponding generated type
Components.Schemas.PropertiesSection in Sources/DocCArchive/generated/Types.swift:
| field | type | required? | enum values / default | note |
|---|---|---|---|---|
kind | string | yes | ["properties"] | Discriminator; always the literal "properties". |
title | string | yes | — | Section heading text; for the dictionary-keys use case this is always the fixed string "Properties" (see DictionaryKeysSection.title). |
items | array of TypedProperty | no (schema does not list it under required; generated Swift type is [TypedProperty]?) | — | swift-docc's authoring-side PropertiesRenderSection.items is non-optional [RenderProperty] and the translator only emits the section when the filtered key list is non-empty — so in practice this is always present and non-empty on the wire, even though the vendored schema marks it optional. |
Fields of TypedProperty (one entry in items):
| field | type | required? | enum values / default | note |
|---|---|---|---|---|
name | string | yes | — | The dictionary key's name. |
type | array of DeclarationToken | yes | — | Encoded/decoded under wire key type; the generated Swift property is named _type because type is a reserved word in the generated context. |
typeDetails | array of TypeDetails | no | — | Each entry has optional baseType (string) and arrayMode (bool); used when a property's value can be one of several base types (e.g. monthOfBirth being either an integer or a string). |
content | array of RenderBlockContent | no | — | Free-form documentation markup describing the property. |
attributes | array of Attribute (oneOf StringAttribute / ArrayAttribute / TypesAttribute) | no | discriminated by inner kind | StringAttribute.kind enum in the vendored spec is ["default","minimum","minimumExclusive","maximum","maximumExclusive"] — note minimumLength/maximumLength exist in swift-docc's current Swift RenderAttribute.Kind enum but are not present in this vendored spec's StringAttribute.kind enum (vendored at swift-docc commit 5915e66, "6.3-nightly", per Sources/DocCArchive/VendorVersion.swift — older/different from this page's pinned 8b8d8268aa1). ArrayAttribute.kind is ["allowedValues"] with a values: [string] field. TypesAttribute.kind is ["allowedTypes"] with a values: [[DeclarationToken]] field. |
mimeType | string | no | — | Present on the swift-docc Swift model too (RenderProperty.mimeType); not exercised in the dictionary-keys example above. |
readOnly | boolean | no | swift-docc default false when set programmatically; absent on the wire when not applicable | — |
required | boolean | no | swift-docc default false | Drives the "(Required)" text in PropertyTable.vue. |
deprecated | boolean | no | swift-docc default false | Drives the strikethrough name + "Deprecated" badge in PropertyTable.vue. |
introducedVersion | string | no | — | Not consumed by PropertyTable.vue/ParameterAttributes.vue as of the pinned swift-docc-render commit — present on the wire but currently unused by this renderer's UI. |
DocCArchive transform status: not yet implemented. Sources/DocCArchive/DocCArchive.swift
defines MyHTMLTransformer and MyMarkdownTransformer as stub placeholders
(MyHTMLTransformer.convert returns a hardcoded HTML comment, MyMarkdownTransformer.convert
returns an empty string), so a properties section decoded into
Components.Schemas.PropertiesSection would parse correctly today but is not yet walked or
rendered by either transformer.
4. HTML/CSS mapping in DocC-Render output
- Root element: a plain
<section>(no dedicated class) fromPropertyTable.vue's template, containing aLinkableHeading(renders<h2 id="{anchor}">by default, whereanchorisanchorize(title)— for the dictionary-keys case, that's the slug for the string"Properties") followed by the table body. - Table body:
ParametersTable.vuerenders a<div class="parameters-table property-table">(theproperty-tableclass is added byPropertyTable.vuewhen it instantiates<ParametersTable class="property-table">), containing oneRow(GridRow) per property with classparam, each split into twoColumn(GridColumn) elements:param-symbol(name + optionally the type) andparam-content(description slot). - Property name:
<div class="property-name">(with modifier classdeprecatedwhen applicable) wrapping a<code>viaWordBreak. - Deprecated badge:
<Badge variant="deprecated" class="property-deprecated">. - Attributes list:
<div class="parameter-attributes">fromParameterAttributes.vue, one child per present attribute kind, each produced byParameterMetaAttribute.vue. - SCSS files involved:
src/components/DocumentationTopic/PrimaryContent/PropertyTable.vue(scoped styles for.property-name,.property-deprecated, and the inline.contentdisplay-inline hack that lets "(Required)" prefix the first paragraph of prose),src/components/DocumentationTopic/PrimaryContent/ParametersTable.vue(scoped styles for.parameters-table,.param,.param-symbol,.param-content, and the API-diffchanged/changed-added/changed-removedhighlighting), andsrc/components/DocumentationTopic/PrimaryContent.vue(scoped.primary-contentwrapper spacing shared by every section kind in the sidebar-content column). - CSS custom properties consumed:
--spacing-param(row-to-row gap between.paramelements, defined asrem(28px)insrc/styles/base/_typography.scss),--color-link(used by.type-identifier-linkinside.param-symbol), and--colors-grid/--color-gridplus--content-table-title-border-widthconsumed by the shared.primary-content.with-border::beforerule inPrimaryContent.vue.
5. Modern CSS-only alternative
NOT APPLICABLE
The current JS/Vue behavior in play here is entirely static markup generation: PropertyTable.vue
and ParametersTable.vue just map a data array into a fixed two-column grid of rows with no
component-local reactive state, no v-show/v-if toggling driven by user
interaction, and no click handlers that change what's visible after the initial render (the only
conditionals — shouldShiftType(), shouldRender() in
ParameterAttributes.vue, and the deprecated/required/
readOnly booleans — are all evaluated once from the RenderNode JSON at render time, not
re-evaluated in response to any runtime event). The one piece of interactivity, the
LinkableHeading deep-link icon and its router-link, is just an anchor navigation
affordance identical to any other in-page heading link on the site and is already served by a plain
<a href="#properties"> — nothing here needs a client-state-holding mechanism like
<details>, a :checked radio trick, or :target to replace,
because there is no interactive show/hide/tab/switch behavior in this render section to begin with.