Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Documentation comments

Platform spec node

Documentation comments

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

Defines how documentation comments attach to declarations and how tools must expose them. Lexical rules for /// are in Lexical and syntax.

  • A documentation run (DocRun) is one or more consecutive lines starting with /// where the third / is not followed by another /.
  • Documentation must attach only to items parsed through ItemWithDocs or parameter/method/variant doc wrappers.
  • Leading documentation on an item must appear immediately before the item’s inner declaration (after attributes, if any).
  • The compiler must preserve doc text in semantic snapshots for LSP hover and generated API docs.
  • Doc text is informative for type checking; it must not alter name lookup or contract satisfaction.
  • Tools should render DocRun as Markdown-compatible plain text.

Malformed doc attachment should warn once the doc pipeline is strict; v0.1 may ignore orphan /// outside wrappers.

Formatter must not reorder /// runs across distinct items. LSP must return stored doc strings for resolved symbols.

  • D-LM-DOC-001 — /// only: Block and // comments never form API documentation.
  • D-LM-DOC-002 — Non-normative doc: Doc comments cannot introduce new MUST rules.
  • D-LM-DOC-003 — @arg on callables only: Parameter tags apply to functions, methods, and contract methods—not record fields.
  • D-LM-DOC-004 — Signatures from compiler: api.json types and links are compiler-derived; prose must not invent parallel type strings.

Structured comments attach human-readable contracts to declarations. Tooling must preserve them through formatting and refactors without changing semantics.

beskid doc emits api.json schema v4 with compiler-derived signatures and type links for every resolved symbol. Authors do not duplicate type names in JSON: non-primitive types use typeAnnotation.refItemId for navigation; optional /// prose uses @ref(Qualified.Name) for markdown cross-links in docMarkdown and structured summaryMarkdown.

@ref resolution uses the same qualifiedName index as api.json rows (not raw declaration name alone). Packed docs emit registry links of the form /docs/{package}@{version}/api/{qualifiedName} when a publish context is available; cross-package targets use the target row’s declaringPackage when present. See Registry API reference UI.