section

properties

Wire value: "properties"

Appears on: Documentation Topic

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:

Properties
age
integer — Minimum: 0   Maximum: 120
genre (Read-Only)
string — Default value: Classic Rock   Possible Values: Classic Rock, Folk, null
monthOfBirth
Possible Types: integer, string
name
string (Required)

3. 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:

fieldtyperequired?enum values / defaultnote
kindstringyes["properties"]Discriminator; always the literal "properties".
titlestringyes—Section heading text; for the dictionary-keys use case this is always the fixed string "Properties" (see DictionaryKeysSection.title).
itemsarray of TypedPropertyno (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):

fieldtyperequired?enum values / defaultnote
namestringyes—The dictionary key's name.
typearray of DeclarationTokenyes—Encoded/decoded under wire key type; the generated Swift property is named _type because type is a reserved word in the generated context.
typeDetailsarray of TypeDetailsno—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).
contentarray of RenderBlockContentno—Free-form documentation markup describing the property.
attributesarray of Attribute (oneOf StringAttribute / ArrayAttribute / TypesAttribute)nodiscriminated by inner kindStringAttribute.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.
mimeTypestringno—Present on the swift-docc Swift model too (RenderProperty.mimeType); not exercised in the dictionary-keys example above.
readOnlybooleannoswift-docc default false when set programmatically; absent on the wire when not applicable—
requiredbooleannoswift-docc default falseDrives the "(Required)" text in PropertyTable.vue.
deprecatedbooleannoswift-docc default falseDrives the strikethrough name + "Deprecated" badge in PropertyTable.vue.
introducedVersionstringno—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

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.