1. How swift-docc-render consumes this
This is an honest negative result: swift-docc-render does not consume the fileType
reference kind at all. The FileTypeRenderReference object — a references
dictionary entry with type: "fileType", meant to carry a displayName and
iconBase64 icon for a class of file — has no matching Vue component, no
references[id].type === 'fileType' branch, and no read of displayName or
iconBase64 anywhere under src/components/ or src/views/ at the pinned
commit. A grep of the whole src/ tree for displayName/iconBase64/
FileTypeRenderReference returns nothing.
There is a different, easily-confused piece of the schema that does get consumed: a plain string
property also named fileType that lives on the codeListing block
(and on the unrelated FileRenderReference/file reference kind for a specific named
file). In components/ContentNode.vue's block-dispatch render() function, the
codeListing case reads node.fileType and forwards it as a prop:
case BlockType.codeListing: {
...
const props = {
syntax: node.syntax,
fileType: node.fileType,
content: node.code,
...
};
return createElement(CodeListing, { props });
}
(src/components/ContentNode.vue#L267-L281).
That string flows down through
CodeListing.vue#L18-L24
(as a prop on CodeListingFilename) to a three-line template in
CodeListingFileIcon.vue#L11-L20:
<SwiftFileIcon v-if="fileType === 'swift'" class="file-icon" />
<GenericFileIcon v-else class="file-icon" />
That is the entirety of "file type" handling in the render layer: a binary string comparison
(=== 'swift') picking between exactly two hardcoded SVG icon components. There is no
generic file-type-to-icon lookup table, no use of a displayName, and no decoding of a
Base64 icon anywhere — which is exactly what the fileType reference kind documented
on this page would have supplied if it were wired up.
Confirming this is not a search miss: swift-docc's own CodableRenderReference decode switch
(CodableRenderReference.swift#L25-L46)
only ever decodes a FileTypeReference when it encounters type: "fileType"
in a references dictionary — grepping all of swift-docc's Sources/ and Tests/ for
a call that constructs FileTypeReference(...) turns up nothing. The type exists purely
so a decoder that receives externally-produced (or historical) RenderNode JSON containing this reference
kind won't crash; nothing in the current swift-docc render-node generator emits one, and nothing in
swift-docc-render reads one back out.
See also: The references map — how this and every other reference-dictionary lookup works across kinds.
2. Example JSON and rendered mockup
No fixture containing a "type": "fileType" reference was found in
Tests/DocCArchiveTests/Fixtures/ (only compiled/bundled .js assets under
SampleLibrary.doccarchive/js/ and ExampleDocs.doccarchive/js/ match the literal
string "fileType", and those are minified swift-docc-render application bundles, not RenderNode JSON) nor in
swift-docc's Tests/SwiftDocCTests/ tree. The following is hand-written directly
from the required fields in the data sheet below.
{
"type": "fileType",
"identifier": "filetype:swift-source",
"displayName": "Swift Source File",
"iconBase64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
}
Because nothing in swift-docc-render actually resolves this reference kind (section 1), there is no real
rendered output to screenshot or reproduce faithfully. The mockup below shows what the schema's own fields
imply the intended presentation would be — an icon decoded from iconBase64 next to
displayName — analogous to how CodeListingFileIcon.vue pairs an icon with a
filename, but built here from data this kind provides that CodeListingFileIcon.vue does not
actually use.
(speculative — this reference kind is not rendered by swift-docc-render; see section 1)
3. Data sheet
Schema object: #/components/schemas/FileTypeRenderReference in
Sources/DocCArchive/Vendored/RenderNode.spec.json (lines 1694-1712), one of the
oneOf variants of the RenderReference discriminated union
(RenderNode.spec.json line 1503). Generated Swift:
Components.Schemas.FileTypeRenderReference, a plain Codable, Hashable, Sendable
struct at Sources/DocCArchive/generated/Types.swift:2396-2426, reachable as the
.FileTypeRenderReference case of the generated RenderReference enum
(Types.swift:2123, decode branch at line 2155, encode branch at line 2204). This corresponds
to swift-docc's authoring-side FileTypeReference struct at
Sources/SwiftDocC/Model/Rendering/References/FileReference.swift:101-123.
| Field | Type | Required? | Enum values / default | Note |
|---|---|---|---|---|
type | string | yes | "fileType" | Discriminator; generated as _TypePayload with the single case .fileType. Corresponds to the .fileType case of swift-docc's RenderReferenceType enum (RenderReference.swift:29). |
identifier | string | yes | — | Key under which this reference is stored in the RenderNode's top-level references dictionary; other content refers back to it by this identifier. |
displayName | string | yes | — | Human-readable name for the file type, e.g. "Swift Source File". Per swift-docc's doc comment, used "to display an icon for that file type alongside the content of that file" — but see section 1: no current renderer reads this field. |
iconBase64 | string | yes | — | Base64-encoded icon image data. On the Swift side this decodes to Foundation.Data (FileTypeReference.iconBase64: Data, FileReference.swift:111); the generated wire type keeps it as a plain Swift.String since the OpenAPI schema declares no format: byte. |
Sibling schema worth distinguishing: FileRenderReference
(RenderNode.spec.json lines 1642-1673 / Types.swift:2310-2365, type
enum "file") is a different reference kind that also happens to declare a required
string field literally named fileType (a file extension/language id like "swift",
distinct from this page's displayName/iconBase64 reference object). It is that
sibling field — not this kind — which reaches CodeListingFileIcon.vue in section 1.
4. HTML/CSS mapping in DocC-Render output
None. Because no Vue component in swift-docc-render at the pinned commit reads
references[id].type === 'fileType', displayName, or iconBase64,
there is no dedicated HTML element, CSS class, SCSS file, or CSS custom property associated with this
reference kind to document. If a fileType reference is present in a RenderNode's
references dictionary but nothing in the node graph resolves it by identifier, it is simply
inert JSON that ships in the archive and is never turned into markup.
The nearest analog with real markup — the fileType string field on
FileRenderReference/codeListing discussed in section 1 — produces an
<svg> from either SwiftFileIcon.vue or GenericFileIcon.vue
inside a <span class="file-icon">
(CodeListingFileIcon.vue#L38-L47),
scoped-SCSS-styled with a fixed height: 24px and margin — but that markup is driven entirely
by the plain string comparison, never by an iconBase64 payload or a FileTypeRenderReference
lookup.
5. Modern CSS-only alternative
Not applicable
Not applicable, for a concrete reason: there is no JS/Vue behavior to replace. This reference kind has no
consuming component, no data-binding, no conditional class, and no interactive or stateful behavior
anywhere in swift-docc-render's source at the pinned commit (section 1) — it is schema-defined, decode-only
dead weight inherited from swift-docc's RenderReference union, never constructed by the
archive generator and never read by the renderer. A "modern CSS-only alternative" question presumes some
existing runtime behavior (state toggled by JS, or a layout/interaction pattern) that a native selector or
element could hold instead; since none exists here, there is nothing for :has(), radio-input
tricks, <details>, or any other native mechanism to stand in for. If this kind were ever
wired up as designed — an icon decoded from iconBase64 shown next to a displayName
label — that pairing would be static, server/build-time-resolvable markup (an <img></img>
or inline <svg> plus a text node) with no client-side state at all, so even a hypothetical
future implementation would likely need zero JavaScript and zero CSS-only "workarounds" — plain HTML would
suffice.