1. How swift-docc-render consumes this
restParameters is one of the "Rest symbol sections" cases on
RenderSectionKind (Sources/SwiftDocC/Model/Rendering/RenderSection.swift,
line 23 at the pinned commit). It is the render section swift-docc emits for the parameter
tables on a REST-API reference page — path parameters, query parameters, and HTTP header
parameters are each rendered as a separate restParameters section (distinguished only
by their title and source field, not by a different kind
string; see the data sheet). It appears inside a symbol/documentation RenderNode's
primaryContentSections array alongside sibling kinds like declarations and
parameters.
On the swift-docc-render side, the dispatch table for primary-content sections lives in
src/components/DocumentationTopic/PrimaryContent.vue, componentFor(section)
(lines 74–90), keyed on the string constants declared in
src/constants/PrimaryContentSection.js (lines 11–27). Both
SectionKind.restParameters and SectionKind.restHeaders /
SectionKind.restCookies map to the same Vue component:
[SectionKind.restBody]: RestBody,
[SectionKind.restParameters]: RestParameters,
[SectionKind.restHeaders]: RestParameters,
[SectionKind.restCookies]: RestParameters,
[SectionKind.restEndpoint]: RestEndpoint,
(restHeaders and restCookies are docc-render-side constants for
forward/defensive compatibility — grepping swift-docc's Swift sources turns up no code path
that ever emits a kind string other than the literal "restParameters";
header- and cookie-sourced parameter tables are still wire-encoded as kind: "restParameters"
with a different source value. See the data sheet for the exact enum mismatch this
implies.) The matching prop-mapping table, a few lines below in the same file
(propsFor(section), lines 106–127), renames the wire field items to
the component prop parameters:
[SectionKind.restParameters]: { parameters: items, title },
The component itself,
src/components/DocumentationTopic/PrimaryContent/RestParameters.vue, renders a
<LinkableHeading> for the section title followed by a
<ParametersTable>, delegating the per-row layout via named slots
(#symbol for the name/type column, #description for the
required/read-only/content/attribute column):
<template>
<section>
<LinkableHeading :anchor="anchor">{{ title }}</LinkableHeading>
<ParametersTable :parameters="parameters" :changes="parameterChanges">
<template #symbol="{ name, type, content, changes, deprecated }">
...
<template #description="{ name, type, content, required, attributes, changes, deprecated, readOnly }">
...
</ParametersTable>
</section>
</template>
<ParametersTable>
(ParametersTable.vue, shared with the plain parameters kind's own
consumer, Parameters.vue) is the actual grid: it iterates parameters and
lays out each one as a GridRow with two GridColumns (a right-aligned
name/type column and a left-aligned description column), filling the two named slots from
RestParameters.vue above. Per-parameter constraint metadata (minimum,
maximum, allowedValues, etc.) is rendered by a further child,
ParameterAttributes.vue, whose own doc comment (line 122–124) explicitly notes
it is "usually [used] in PropertyTable or RestParameters."
Finally, the on-this-page sidebar registers each restParameters section (along with
its restBody/restCookies/restEndpoint/restHeaders/
restResponses/properties siblings) as a level-2 entry keyed by its
title, in
src/mixins/onThisPageRegistrator.js (lines 77–87):
case SectionKind.properties:
case SectionKind.restBody:
case SectionKind.restCookies:
case SectionKind.restEndpoint:
case SectionKind.restHeaders:
case SectionKind.restParameters:
case SectionKind.restResponses:
this.store.addOnThisPageSection({
title: section.title, anchor: anchorize(section.title), level: 2,
});
break;
2. Example JSON and rendered mockup
Real fixture: swift-docc's own test suite includes a full REST symbol RenderNode fixture,
Tests/SwiftDocCTests/Rendering/Rendering Fixtures/rest-symbol.json, exercised by
RESTSymbolsTests.swift. It contains three separate restParameters
sections — one each for source: "path", source: "query", and
source: "header". The path-parameter one (abridged: full fixture also includes a
second query parameter and additional typeDetails) is:
{
"kind": "restParameters",
"title": "Path Parameters",
"source": "path",
"items": [
{
"name": "id",
"type": [
{ "kind": "text", "text": "string" }
],
"typeDetails": [
{},
{ "baseType": "string", "arrayMode": true }
],
"introducedVersion": "1.2",
"required": true,
"content": [
{
"type": "paragraph",
"inlineContent": [
{ "type": "text", "text": "The unique identifier for the artist." }
]
}
]
}
]
}
(Source: Tests/SwiftDocCTests/Rendering/Rendering Fixtures/rest-symbol.json in the
pinned swift-docc checkout, read directly and re-printed verbatim above.)
idstring
mockup: one GridRow per item — a right-aligned name/type column and a
left-aligned description column carrying the "(required)" flag, prose content, and any
attribute constraints.
3. Data sheet
Source: Sources/DocCArchive/Vendored/RenderNode.spec.json, schema object
#/components/schemas/RESTParametersRenderSection, cross-checked against the generated
Components.Schemas.RESTParametersRenderSection struct in
Sources/DocCArchive/generated/Types.swift (lines 6394–6431+), and against the
per-item schema #/components/schemas/TypedProperty (both in the same spec file).
| Field | Type | Required | Enum values / default | Note |
|---|---|---|---|---|
kind |
string | yes | "restParameters" (single-case enum) |
Generated as RESTParametersRenderSection.KindPayload, one case,
.restParameters. The discriminator used to select this schema out of
RenderSection's union. |
title |
string | yes | — | Section heading, e.g. "Path Parameters", "Query Parameters", "HTTP Headers". Also used to
build the on-this-page anchor (anchorize(title)) and, in swift-docc's own
HTTPParametersSectionTranslator.swift, is generated as
"\(parameterSource.rawValue.capitalized) Parameters". |
items |
array of TypedProperty |
yes | — | Decoded onto the generated struct's items property; wired to the Vue
parameters prop via propsFor's { parameters: items, title }
mapping. Corresponds to the hand-written Swift model's RESTParametersRenderSection.parameters:
[RenderProperty] (CodingKeys.parameters = "items"). |
source |
string | yes | "query" | "path" | "header" in the vendored JSON schema (generated as
RESTParametersRenderSection.SourcePayload, 3 cases) |
Verified schema/model drift: swift-docc's hand-written Swift enum
RESTParameterSource (Sources/SwiftDocC/Model/Rendering/Symbol/RESTParametersRenderSection.swift,
lines 17–26) has a fourth case, .cookie ("An HTTP cookie sent with the
request"), that is absent from RenderNode.spec.json's source enum at
the very same pinned commit (checked directly against
Sources/SwiftDocC/SwiftDocC.docc/Resources/RenderNode.spec.json). This means the
vendored JSON schema (and therefore DocCArchive's generated SourcePayload enum) would
fail to decode a real archive containing a cookie-sourced parameters section unless
swift-openapi-generator's decode path tolerates unknown enum raw values — not
verified here. This lines up with docc-render's own defensive SectionKind.restCookies
constant (see section 1), which has no confirmed producer on the swift-docc side either. |
TypedProperty (the shape of each entry in items): |
||||
items[].name |
string | yes | — | Parameter name, e.g. id, l, X-TotalCount. Rendered
bold via <WordBreak tag="code"> in the #symbol slot. |
items[].type |
array of DeclarationToken |
yes | — | Type tokens (e.g. string, [string]); rendered by
PossiblyChangedType in either the symbol or description slot, depending on whether
content is empty (shouldShiftType). |
items[].typeDetails |
array of TypeDetails |
no | — | Extra structured type info (e.g. baseType, arrayMode); not directly
rendered by RestParameters.vue's own template excerpts inspected here. |
items[].content |
array of RenderBlockContent |
no | — | Prose description, rendered via a nested <ContentNode> in the
#description slot. |
items[].attributes |
array of Attribute |
no | — | Constraint metadata (minimum, maximum, allowedValues,
etc.), rendered by <ParameterAttributes>. |
items[].mimeType |
string | no | — | Not consumed by the symbol/description slots inspected in RestParameters.vue;
more relevant to restBody's multipart parts, which reuse the same
TypedProperty/RenderProperty shape. |
items[].readOnly |
boolean | no | — | Shown as a parenthetical "(read-only)" tag in the description slot, via
PossiblyChangedTextAttribute. |
items[].required |
boolean | no | — | Shown as a parenthetical "(required)" tag in the description slot. |
items[].deprecated |
boolean | no | — | Strikes through the parameter name (.deprecated CSS class) and adds a
"deprecated" <Badge> in the description slot. |
items[].introducedVersion |
string | no | — | e.g. "1.2" in the fixture; not read by the slot templates inspected in
RestParameters.vue. |
4. HTML/CSS mapping in DocC-Render output
RestParameters.vueroot: a bare<section>(no class of its own) containing aLinkableHeadingand the parameters table.ParametersTable.vueroot:<div class="parameters-table">; each parameter is aGridRowrendered with class"param"(plus achanged changed-{added|removed|...}class when API-diffing is active), split into twoGridColumns carryingclass="param-symbol"(name/type) andclass="param-content"(description).- Within the symbol slot, the name wrapper is
<div class="param-name">(with an additional.deprecatedclass when applicable); within the description slot, a deprecated badge getsclass="param-deprecated". ParameterAttributes.vueroot:<div class="parameter-attributes">, containing oneParameterMetaAttributeper populated constraint kind (its own sub-component, not read in full here).- SCSS: both
RestParameters.vueandParametersTable.vueship scoped<style lang="scss">blocks importingdocc-render/styles/_core.scss.ParametersTable.vue's block sets per-parameter spacing (margin-top: var(--spacing-param)between consecutive.paramrows), achange-highlight-target()mixin invocation for diff highlighting, and responsive@include breakpoint(small)rules that switch.param-symbolfrom right-aligned to left-aligned and flatten the two-column layout on narrow viewports.RestParameters.vue's own block only overrides font weight/strikethrough for.param-name/.deprecatedand forces the first paragraph of.contentto renderdisplay: inlineso the "(required)" prefix text reads naturally ahead of the prose. - CSS custom properties consumed:
--spacing-param(inter-row spacing) and--colors-grid/--color-grid(border color, consumed one level up by the enclosing.primary-contentblock inPrimaryContent.vue, not byRestParameters.vueitself).
DocCArchive transform status: MyHTMLTransformer and MyMarkdownTransformer
in Sources/DocCArchive/DocCArchive.swift are still stub placeholders (the HTML
transformer returns a hardcoded comment and the Markdown transformer returns an empty string), so
neither currently walks primaryContentSections at all — a restParameters
section would flow through parseRenderNode into the generated
RESTParametersRenderSection Swift type, but no transform yet turns it into HTML or
Markdown output.
5. Modern CSS-only alternative
NOT APPLICABLE
Current behavior: RestParameters.vue and its children
(ParametersTable.vue, ParameterAttributes.vue) render a static grid from
props on mount — there is no client-side toggle, expand/collapse, tab switch, or any other
piece of view state being held in Vue component data() for this kind. The only
dynamic behaviors nearby are (1) responsive column reflow at the breakpoint(small)
SCSS mixin, which is already pure CSS (a media query), and (2) the optional API-diff
"changed/added/removed" highlighting classes, which are computed once from props
(changedClasses(key)) rather than toggled by user interaction. Neither is a piece of
interactive state a native HTML mechanism (<details>, radio+:checked,
:target, <dialog>, etc.) would need to replace, because there is no
show/hide, open/closed, or selected/unselected state on this kind to begin with. Conclusion: this
kind is a static data table with no interactive behavior to migrate.